aboutsummaryrefslogtreecommitdiff
path: root/PuzzleApplet.java
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2022-10-22 13:34:36 +0100
committerBen Harris <bjh21@bjh21.me.uk>2022-10-22 13:55:55 +0100
commit24ce6260d55b53c27bd92a92116816b437e83e0c (patch)
tree8ae8db6d891453f3902aec1bc4e9fa18ff2b47a9 /PuzzleApplet.java
parent9be9a12476b3958f12caad1d43b39243e7758e73 (diff)
downloadpuzzles-24ce6260d55b53c27bd92a92116816b437e83e0c.zip
puzzles-24ce6260d55b53c27bd92a92116816b437e83e0c.tar.gz
puzzles-24ce6260d55b53c27bd92a92116816b437e83e0c.tar.bz2
puzzles-24ce6260d55b53c27bd92a92116816b437e83e0c.tar.xz
js: Pay attention to the device pixel ratio
The CSS "px" unit isn't always a device pixel. On devices with high-DPI displays, there can often be multiple device pixels to a CSS px, while in particularly low-resolution displays (like feature phones), the user might zoom out to get several CSS px to a device pixel. And even on desktop browsers, text zooming controls can change the ratio. To make Puzzles' rendering look good on an arbitrary device pixel ratio, we really want the pixels of the canvas to be device pixels, not CSS px, so that the canvas doesn't have to be scaled by the browser for display. To correct this, we now control the CSS size of the puzzle canvas, via its containing <div>, to be the canvas size divided by the device pixel ratio. There is a significant gap, which is that this doesn't yet track changes to the device pixel ratio. This is slightly complicated, so I'll put it off to the next commit.
Diffstat (limited to 'PuzzleApplet.java')
0 files changed, 0 insertions, 0 deletions