diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2022-10-06 10:11:32 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2022-10-22 13:55:50 +0100 |
| commit | 27f0dafcf0d78b286ccc7812c59fbc5d3e95ebe5 (patch) | |
| tree | 8b6f1ff134e467299235d6790466c18534a5389b /html/samegame.html | |
| parent | 4feb5fdf0cc6c9612e2928f1e2a2335fbbd03a71 (diff) | |
| download | puzzles-27f0dafcf0d78b286ccc7812c59fbc5d3e95ebe5.zip puzzles-27f0dafcf0d78b286ccc7812c59fbc5d3e95ebe5.tar.gz puzzles-27f0dafcf0d78b286ccc7812c59fbc5d3e95ebe5.tar.bz2 puzzles-27f0dafcf0d78b286ccc7812c59fbc5d3e95ebe5.tar.xz | |
js: Map mouse co-ordinates correctly even when CSS scales our canvas
Our system for mapping mouse coordinates to canvas coordinates assumed
that the puzzle canvas had the same dimensions in CSS as its own
internal width and height. This is true in the current wrapper HTML,
but it's very easy to accidentally change and there are circumstances
where we might want to deliberately change it in future.
To fix this, we now inspect the CSS size of the canvas when processing
mouse events, and map the coordinates through the scaling and
translation necessary to convert CSS pixels into canvas pixels.
Diffstat (limited to 'html/samegame.html')
0 files changed, 0 insertions, 0 deletions