Comments (2)
my only current option is to, set the alpha to 0 at the pixel where the current mouse position is on the canvas. and its buggy to do it in this way
however this does not work with elements like TEXT elements.
from nw.js.
current workaround,
<html>
<head>
</head>
<body>
<script>
window.onload = () => {
var newgui = require('nw.gui');
var newWindow = newgui.Window.open('other.html', {
position: 'center',
width: 600,
height: 800,
frame: false,
transparent: true,
always_on_top: true
}, function (win) {
win.show();
});
}
</script>
</body>
</html>
<html>
<head>
<style>
html,
body {
background-color: rgba(0, 255, 0, 0);
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
}
canvas {
width: 100%;
height: 100%;
}
</style>
</head>
<body onload="javascript: start();">
<canvas id="viewCanvas"></canvas>
<script>
function start() {
var mousePOS;
var canvas = document.getElementById("viewCanvas");
canvas.addEventListener('mousemove', function (event) {
const rect = canvas.getBoundingClientRect();
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
mousePOS = { x, y };
});
function draw() {
canvas.width = document.body.clientWidth;
canvas.height = document.body.clientHeight;
const ctx = canvas.getContext("2d");
ctx.globalAlpha = 0.5;
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
ctx.fillStyle = "rgb(0,0,0)";
ctx.rect(0, 0, canvas.width, canvas.height);
ctx.fill();
if (mousePOS) {
var blockSize = 1;
ctx.clearRect(mousePOS.x - blockSize, mousePOS.y - blockSize, blockSize * 2, blockSize * 2); // clear canvas
}
window.requestAnimationFrame(draw);
}
window.requestAnimationFrame(draw);
}
</script>
</body>
</html>
from nw.js.
Related Issues (20)
- %webkit_ver in "user-agent" has what looks like null pointer address output HOT 3
- Application crash on Windows when network changes (like turning on/off Wi-Fi) HOT 1
- Linux/X11: crash on 0.85.0+ when trying to show a tooltip from `title` attributes ("GPU process exited unexpectedly: exit_code=133") HOT 3
- Tray icons are a dedicated, separated window when running on Wayland mode
- nw2 implementation cause windows to become floating ones on tiling compositors
- URL.createObjectURL still fails HOT 1
- Buffer Overflow in WriteImage HOT 2
- Youtube Music Premium Bug HOT 3
- "-webkit-app-region: drag;" does not work in version 0.88.0 HOT 5
- --remote-debugging-port=9222 fails HOT 6
- WebGPU issues HOT 2
- Missing binary when installing nwjs using pnpm HOT 1
- app
- Segmentation fault when calling `chrome.privacy.services.autofillEnabled.set` HOT 6
- Security warning stops running nwjs on MacOS HOT 1
- Unchecked runtime.lastError: Invalid value for bounds. Bounds must be at least 50% within visible screen space.
- How to run axios in node js context with nw.js HOT 1
- Application crash on restart application
- When using url in main, global object not available in page HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nw.js.