fix: make pixelhub fully responsive and touch-playable on phones#15
Merged
Conversation
The chat panel used a fixed 320px width inside a flex row, so on a 375-414px phone viewport it consumed nearly the entire screen and left the game canvas as a sliver. On top of that, WorldScene only ever read keyboard input, so there was no way to move the avatar on a touchscreen at all. #### Changes made - Chat panel becomes an off-canvas drawer below 700px width (or short landscape heights), toggled by a floating button and closed via a backdrop tap, so the game canvas gets the full screen on phones. - Added an on-screen virtual joystick (client/src/ui/touchControls.ts), shown only on coarse-pointer (touch) devices, that feeds the same MovementInput the keyboard produces so WorldScene.readInput merges both sources. - Bumped mobile tap targets and chat input font-size to 16px to stop iOS Safari from auto-zooming on focus, and added viewport-fit=cover plus safe-area-inset padding for notched phones. - Updated the join-screen hint and two docs (ADR-002, system-design) that described input as keyboard-only.
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.
The chat panel used a fixed 320px width inside a flex row, so on a 375-414px phone viewport it consumed nearly the entire screen and left the game canvas as a ~55px sliver. On top of that,
WorldScene.readInputonly ever read keyboard keys, so there was no way to move the avatar on a touchscreen at all. This fixes both, verified with headless Chrome touch emulation at 375x667, 414x896, and 812x375 (landscape).Changes made
#chat-toggle) and closed via a tap on the backdrop, so the game canvas gets the full screen on phones instead of losing most of its width to a fixed sidebar.client/src/ui/touchControls.ts), shown only on coarse-pointer (touch) devices viamatchMedia('(pointer: coarse)'), that produces the sameMovementInputshape the keyboard does.WorldScene.readInputnow merges keyboard and touch sources, so nothing changes for desktop/keyboard play.viewport-fit=coverand safe-area-inset padding so the joystick and chat drawer stay clear of notches/home indicators.Test plan
pnpm typecheckpasses across shared/server/clientpnpm testpasses (78 client tests, including 8 new joystick tests and 3 new drawer tests)pnpm -r buildsucceeds