Emscripten: Rework touch input and add pixel-perfect scaling#3556
Open
johannschopplich wants to merge 6 commits into
Open
Emscripten: Rework touch input and add pixel-perfect scaling#3556johannschopplich wants to merge 6 commits into
johannschopplich wants to merge 6 commits into
Conversation
Member
|
Jenkins: Test this please Thanks! Have to take a look at this :) |
The shell sized the canvas from document.body, which collapses to zero height in this layout, so SDL's inline size shrank it on load (most visibly in Chrome). Make the fit-mode CSS authoritative with !important, and recompute integer scaling from a ResizeObserver on the viewport so it reflows correctly after an orientation change instead of overflowing.
Clicking a control button moves focus to the button and swallows the arrow keys. Return focus to the canvas after a control click and on fullscreen change so keyboard input keeps reaching the game.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR brings a batch of web-shell improvements over from my production setup on realtroll.de. Mostly touch and scaling work that's been running there a while – figured it's worth upstreaming rather than sitting in a fork. 🙂
What's New?
localStorage. Defaults on for non-touch devices – a visible change for existing desktop pages, so happy to flip it to opt-in if you'd rather not move the default.Smaller bits
visibilitychangeso the screen doesn't sleep mid-session.scanGamePadspoll – it only armed whenongamepadconnectedwas missing, but those events predate WASM in every browser, so nothing that can run the player reached that path.The embedded player should work as is, integer scaling is of course disabled in this case.
Tested on past + edge releases of the EasyRPG Player build I ship at realtroll.de, desktop + touch (Android/iOS).