js: Move much of the handling of device pixel ratios to the mid-end

Now that the mid-end knows how to do it, we can remove some complexity
from the front end.
This commit is contained in:
Ben Harris
2022-11-07 23:02:06 +00:00
parent e45cd43aaa
commit ad9ee5a524
3 changed files with 21 additions and 63 deletions

View File

@ -558,22 +558,6 @@ mergeInto(LibraryManager.library, {
offscreen_canvas.height = h;
},
/*
* void js_canvas_set_nominal_size();
*
* Set the nominal size of the puzzle to the current canvas size
* scaled to CSS pixels. This should be called whenever the
* canvas size is changed other than in response to a change of
* device pixel ratio. This nominal size will then be used at
* every change of device pixel ratio to calculate the new
* physical size of the canvas.
*/
js_canvas_set_nominal_size: function() {
var dpr = window.devicePixelRatio || 1;
nominal_width = onscreen_canvas.width / dpr;
nominal_height = onscreen_canvas.height / dpr;
},
/*
* double js_get_device_pixel_ratio();
*