js: Very bad attempt at making puzzles change size when zooming

This has the entertaining consequence that repeatedly zooming in and out
causes puzzles to gradually shrink, thus demonstrating that recording
the nominal size correctly will be necessary.
This commit is contained in:
Ben Harris
2022-10-27 10:12:54 +01:00
parent 5af0cd4ac1
commit 532d662722
2 changed files with 12 additions and 3 deletions

View File

@ -544,12 +544,15 @@ mergeInto(LibraryManager.library, {
* size.
*/
js_canvas_set_size: function(w, h) {
var dpr = window.devicePixelRatio || 1;
onscreen_canvas.width = w;
offscreen_canvas.width = w;
resizable_div.style.width = w / (window.devicePixelRatio || 1) + "px";
resizable_div.style.width = w / dpr + "px";
nominal_width = w / dpr;
onscreen_canvas.height = h;
offscreen_canvas.height = h;
nominal_height = h / dpr;
},
/*