Skip to content

Commit

Permalink
fix(output-window): sets size on creation of window and removes overf…
Browse files Browse the repository at this point in the history
…low (#756)
  • Loading branch information
2xAA authored Aug 28, 2022
1 parent a437abd commit b3df0f6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
25 changes: 21 additions & 4 deletions public/output-window.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<!-- prettier-ignore -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>

<body style="margin: 0px; display: flex; justify-content: center; align-items: center;"></body>
<head>
<meta charset="utf-8">
<style>
html,
body {
height: 100%;
}

body {
overflow: hidden;
background-color: #000;
margin: 0px;
display: flex;
justify-content: center;
align-items: center;
}
</style>
</head>

<body></body>

</html>
18 changes: 12 additions & 6 deletions src/application/window-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ export default function windowHandler() {
};
}

function setSize(win) {
const { innerWidth: width, innerHeight: height } = win;

this.store.dispatch("size/setSize", {
width,
height
});
}

this._store.subscribe(async ({ type, payload }) => {
if (type === "windows/ADD_WINDOW") {
const { width, height, backgroundColor, title, id } = payload;
Expand Down Expand Up @@ -108,14 +117,11 @@ export default function windowHandler() {

// Setup the new requestAnimationFrame()
timer = requestAnimationFrame(() => {
const { innerWidth: width, innerHeight: height } = win;

this.store.dispatch("size/setSize", {
width,
height
});
setSize.call(this, win);
});
});

setSize.call(this, win);
}
});

Expand Down

0 comments on commit b3df0f6

Please sign in to comment.