Skip to content

feat(mobile): compact play layout, touch stick, and action pad (#21) - #355

Open
Aduersarius wants to merge 1 commit into
Bitcoindefi:mainfrom
Aduersarius:feat/mobile-playability-21
Open

feat(mobile): compact play layout, touch stick, and action pad (#21)#355
Aduersarius wants to merge 1 commit into
Bitcoindefi:mainfrom
Aduersarius:feat/mobile-playability-21

Conversation

@Aduersarius

Copy link
Copy Markdown

Summary

Ships mobile playability for #21 so /play is usable on a phone without changing desktop.

  • Compact play layout: coarse-pointer / narrow-touch detection scales the fixed 21×21 canvas to the viewport (same CSS stretch model as fullscreen). Side inventory becomes an overlay sheet (Panel) instead of requiring ~1050px width.
  • Virtual stick → real movement path: useTouchStickMovement updates the same movementPressCountsRef / movementKeyPriorityRef the keyboard uses, via a dedicated __touch_stick__ source code. No synthetic KeyboardEvents (blocked by isTrusted). Engine throttle / inmo / para unchanged.
  • Touch action cluster: attack, spell (selected / opens panel), use item, pickup, seguro, chat, panel — wired to existing packets / requests.
  • Long-press = right-click on the map (touch/pen only); mouse path unchanged.
  • Landscape gate overlays in portrait without remounting the session tree (rotation must not drop the socket).
  • Stuck-input clear on visibilitychange / pagehide / blur.
  • PWA: viewport-fit: cover, non-scalable viewport, manifest orientation: "landscape".
  • Pure helpers + node --experimental-strip-types --test frontend/lib/mobile/playability.test.ts.

Differentiation vs open PRs

PR Gap vs this
#42 (waterWang) Joystick-only MVP; CSS max-width hack; clears all movement counts on turn; no action pad / long-press / compact HUD overlay; LandscapePrompt mounted awkwardly.
#61 (angelTomo9) Kitchen-sink (protocol, map moderation, converter, …); MobileTouchControls UI is not wired into MapRenderer movement/combat; conflicting with main. This PR is #21-only and hooks the real input/combat paths.

Test plan

  • node --experimental-strip-types --test frontend/lib/mobile/playability.test.ts
  • Phone landscape: canvas fits; stick walks at keyboard step rate; attack/hechizo/usar/chat/panel work
  • Portrait: rotate overlay; rotate back without reconnect
  • Long-press tile ≈ right-click; tap still left-click / walk
  • Background the tab / lock screen → movement not stuck on return
  • Desktop fine-pointer: unchanged layout, no stick/action pad

Tracks #21.

…indefi#21)

Make /play usable on phones without changing desktop: scale the canvas
in compact layout, overlay the HUD panel, bridge a virtual stick into
the existing movement refs (no synthetic keyboards), add touch actions,
map long-press to right-click, and clear stuck movement on hide/blur.
@gitar-bot

gitar-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant