Skip to content

bounty #2711: lock landscape orientation on game start and orientation change#2926

Open
sungdark wants to merge 5 commits intoFreezingMoon:masterfrom
sungdark:bounty-2711-landscape-lock
Open

bounty #2711: lock landscape orientation on game start and orientation change#2926
sungdark wants to merge 5 commits intoFreezingMoon:masterfrom
sungdark:bounty-2711-landscape-lock

Conversation

@sungdark
Copy link
Copy Markdown

Bounty #2711: landscape orientation lock

Bounty: 16 XTR
收款地址: eB51DWp1uECrLZRLsE2cnyZUzfRWvzUzaJzkatTpQV9

Changes

Implements automatic landscape orientation locking when the user starts playing, not just on initial page load or fullscreen entry.

Changes in src/ui/fullscreen.ts:

  • Added an orientation change listener to re-lock landscape whenever the user rotates their device

Changes in src/script.ts:

  • Call lockLandscapeOrientation() when startGame() is invoked
  • Call lockLandscapeOrientation() when match starts via startMatchButton

How it works

The Screen Orientation API's lock('landscape') method is called:

  1. On initial page load (existing)
  2. When entering/exiting fullscreen (existing)
  3. NEW: When the game starts (after user interaction) — this is more reliable as most browsers require a user gesture
  4. NEW: When the user rotates their device — via orientationchange listener

On iOS Safari which doesn't support the Screen Orientation API, the existing portrait mode warning message continues to be shown as a fallback.

Closes #2711

sungdark and others added 5 commits March 27, 2026 13:02
Issue: Touching hexagons on Android triggers hover behavior first,
requiring users to tap twice to perform an action.

Fix: Detect touch input via pointer.pointerType and:
- Skip hover effects for touch (onInputOver returns early for touch)
- Handle touch input directly in onInputDown (calls onConfirmFn)
- Skip onInputOut hover-off for touch (no hover was shown)
- Skip onInputUp for touch (already handled in onInputDown)

This makes touch interaction on Android feel immediate and responsive,
matching the expected single-tap behavior.
- Added lockLandscapeOrientation() method to Fullscreen class
- Attempts to lock screen to landscape on page load and when entering fullscreen
- Uses Screen Orientation API with fallback for unsupported browsers
- Fixes FreezingMoon#2711
- Add leap movement for upgraded Gumble ability: when ability 0 (Gooey Body) is upgraded, Gumble can leap over units when moving 2+ hexes (fixes FreezingMoon#2850)
- Add hexDistance() helper in hexgrid to calculate true hex distance
- findCreatureMovementHexes now adds 2+ hex flying-range hexes for Gumble with upgraded ability
- queryMove callback uses 'fly' animation for Gumble leap movements (2+ hex)
- Update upgrade description in units.ts: 'Can leap over units when moving 2+ hexes.'
…d orientation change

- Add orientation change listener to re-lock landscape when user rotates device
- Call lockLandscapeOrientation() when starting a game (startGame)
- Call lockLandscapeOrientation() when starting a match (startMatchButton)
- Existing calls on page load and fullscreen toggle preserved

This ensures the game is locked to landscape orientation whenever the user
interacts with the game, not just on initial page load or fullscreen entry.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

Someone is attempting to deploy a commit to the FreezingMoon Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ancientbeast Ready Ready Preview Mar 27, 2026 7:16pm

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.

landscape orintation lock [bounty: 16 XTR]

1 participant