Skip to content

Commit

Permalink
resize displayed canvas once per debounce
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Fernández Serrata committed Mar 5, 2024
1 parent aba9256 commit 63ca44d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,12 @@ const RGBDR_anim = (() => {
And set font-size accordingly
*/
const resize = () => {
const { clientWidth, clientHeight } = body
canv.style.width = clientWidth + 'px'
canv.style.height = clientHeight + 'px'
const scale = devicePixelRatio
canv.width = body.clientWidth * scale >>> 0
canv.height = body.clientHeight * scale >>> 0
canv.width = clientWidth * scale >>> 0
canv.height = clientHeight * scale >>> 0
// is normalization necessary?
//ctx.scale(scale, scale)
ctx.font = `bold ${get_droplet_size()}px monospace`
Expand Down
2 changes: 0 additions & 2 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ canvas {
position: absolute;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
image-rendering: pixelated
}

0 comments on commit 63ca44d

Please sign in to comment.