Skip to content

Commit

Permalink
restore canvas after resize
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Fernández Serrata committed Mar 7, 2024
1 parent 31d28d4 commit 5910cae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,14 @@ const RGBDR_anim = (() => {
canv.style.width = clientWidth + "px"
canv.style.height = clientHeight + "px"
const scale = devicePixelRatio
const save = ctx.getImageData(0, 0, w, h)
w = canv.width = clientWidth * scale >>> 0
h = canv.height = clientHeight * scale >>> 0
ctx.putImageData(save, 0, 0)
//ctx.scale(scale, scale) // is normalization necessary?
// should it be W, H, max(W,H), min(W,H), hypot(W,H), or sqrt(W * H)?
droplet_abs_size = anim.settings.droplet_rel_size * w

//issue #43
droplet_abs_size = anim.settings.droplet_rel_size * Math.min(w, h) * 2
ctx.font = `bold ${droplet_abs_size}px monospace`
}

Expand Down

0 comments on commit 5910cae

Please sign in to comment.