HTMLElement..style.zoom is non-standard but widely supported. (The only exception is Firefox.)
This PR adds the following support for when a Hypergrid is zoomed by this feature (when any elements from <body> to <canvas> have their zoom style set to something other than 1):
Canvas resolution is now optimized with respect to the zoom settings of all the elements in the chain
Mouse tracking coordinates are now properly adjusted when zoomed
Tested on Chrome, Safari, IE 11 (which needed some special case coding), and regression tested on Firefox where it has no effect.
Added method grid.resetZoom() which should be called:
Any time you set the zoom style of one or more of the elements in the chain. This does two things: Optimizes the canvas resolution; adjusts the mouse coordinates.
After user adjusts browser zoom using ctrl +/- to optimize the resolution. This optimizes the canvas resolution for a sharper image. The mouse coordinates are not adjusted for browser zoom. The only way to tell if browser zoom changed (I believe) is to poll getComputedStyle(htmlElement).zoom (where htmlElement = document.body.parentElement).
HTMLElement..style.zoom is non-standard but widely supported. (The only exception is Firefox.)
This PR adds the following support for when a Hypergrid is zoomed by this feature (when any elements from
<body>
to<canvas>
have theirzoom
style set to something other than1
):Tested on Chrome, Safari, IE 11 (which needed some special case coding), and regression tested on Firefox where it has no effect.
Added method
grid.resetZoom()
which should be called:zoom
style of one or more of the elements in the chain. This does two things: Optimizes the canvas resolution; adjusts the mouse coordinates.getComputedStyle(htmlElement).zoom
(wherehtmlElement = document.body.parentElement
).