js: Distinguish manual resizes from device pixel ratio changes

This adds a new callback, rescale_puzzle(), that's called when the
device pixel ratio changes.  This means that resize_puzzle() can safely
set the nominal canvas size, which means that manual resizing of the
puzzle now sticks.

Still missing: paying attention to the device pixel ratio when choosing
the initial (or reset) size.
This commit is contained in:
Ben Harris
2022-10-27 14:30:23 +01:00
parent 9783bbfbc0
commit fa58dd85b7
3 changed files with 14 additions and 3 deletions

View File

@ -26,6 +26,8 @@ set(emcc_export_list
# Callbacks when the resizing controls are used
_resize_puzzle
_restore_puzzle_size
# Callback when device pixel ratio changes
_rescale_puzzle
# Main program, run at initialisation time
_main)