Skip to content

fix: lock screen orientation to landscape (#2711)#2917

Open
sungdark wants to merge 1 commit intoFreezingMoon:masterfrom
sungdark:fix/landscape-orientation-lock-bounty-2711
Open

fix: lock screen orientation to landscape (#2711)#2917
sungdark wants to merge 1 commit intoFreezingMoon:masterfrom
sungdark:fix/landscape-orientation-lock-bounty-2711

Conversation

@sungdark
Copy link
Copy Markdown

Description

Locks the game screen to landscape orientation using the Screen Orientation API.

Changes:

  • src/ui/fullscreen.ts: Added lockOrientation() method that calls screen.orientation.lock('landscape') when entering fullscreen, and screen.orientation.unlock() when exiting
  • src/script.ts: Added orientation lock attempt in startGame() for non-fullscreen PWA contexts

How it works:

  • When entering fullscreen mode (via the fullscreen button or F11 hotkey), the screen orientation is locked to landscape using the Screen Orientation API
  • When exiting fullscreen, the orientation is unlocked
  • When the game starts, an orientation lock is attempted (works in fullscreen or PWA context on supporting browsers like Chrome Android)
  • The existing PWA manifest already has "orientation": "landscape" for installed apps
  • The existing orientation message overlay still serves as a fallback for browsers that don't support the API

Closes #2711

- Add screen.orientation.lock('landscape') when entering fullscreen
- Unlock orientation when exiting fullscreen
- Attempt orientation lock when game starts (works in fullscreen/PWA context)
- Closes FreezingMoon#2711
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@penggaolai 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:18pm

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]

2 participants