Skip to content

Commit fdedeb2

Browse files
committed
Fix #2: Use CSS over device pixels for window size
1 parent 66a9c48 commit fdedeb2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

p5js/js/electron/resizer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ const observer = new MutationObserver((mutationList) => {
77
mutation => mutation.addedNodes[0]?.nodeName === "MAIN"
88
).length > 0;
99
if (p5Ready) {
10-
const { width, height } = document.querySelector("canvas");
10+
// Choose CSS over device pixels for proper window size across all screens
11+
const { style } = document.querySelector("canvas");
12+
const width = parseInt(style.width);
13+
const height = parseInt(style.height);
1114
pde.resize({
1215
width,
1316
height

0 commit comments

Comments
 (0)