Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default, most browsers apply a default margin of 8px to the
body
element. On mobile, PuzzleScript applies the following style thebody
element:The
position: "fixed"
creates a new document flow root, which means that any children withposition: absolute
are going to be positioned with the 8px offset, including the game canvas.This can be seen by simulating a mobile device (or using a real mobile device) and inspecting the body and game canvas elements (note the orange margin at the top and left):
Here's another example where I've set the viewport size so that the game should fit perfectly on the screen, but you can see everything is offset slightly:
This caused two issues:
relMouseCoords
ininputoutput.js
were offset by 8px. This was most noticeable when using the PuzzleScript Plus fork with support for touch controls.The fix is just to set the
body
margin to 0 and make sure the mobile pull-out menu is still positioned correctly. After the fix, the above game fits on screen as expected: