Skip to content

Commit

Permalink
Set zoom on the canvas element, not the whole page?
Browse files Browse the repository at this point in the history
What we're really after is to make the canvas fill the screen on
high-dpi (phone) screens. Scaling the whole page achieves the effect,
but with some collateral damage of weird sizing issues.
  • Loading branch information
sz3 committed Jun 12, 2021
1 parent d0dffa2 commit a7f663a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ return {
resize : function()
{
// reset zoom
document.body.style.zoom = (window.innerWidth / window.outerWidth);
var canvas = document.getElementById('canvas');
canvas.style.zoom = (window.innerWidth / window.outerWidth);
var width = window.outerWidth;
var height = window.outerHeight;
Main.scaleCanvas(canvas, width, height);
Expand Down Expand Up @@ -83,6 +83,7 @@ return {
invisible_click.style.height = canvas.style.height;
invisible_click.style.top = cpos.top + "px";
invisible_click.style.left = cpos.left + "px";
invisible_click.style.zoom = canvas.style.zoom;
},

encode : function(filename, data)
Expand Down

0 comments on commit a7f663a

Please sign in to comment.