Skip to content

Add gyroscope controls for camera panning on handheld devices - #386

Open
git-chad wants to merge 5 commits into
mainfrom
tobi/poc-gyroscope-controls
Open

Add gyroscope controls for camera panning on handheld devices#386
git-chad wants to merge 5 commits into
mainfrom
tobi/poc-gyroscope-controls

Conversation

@git-chad

@git-chad git-chad commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Note

Introduces gyroscope-driven camera panning on handheld devices, with permission handling, state management, and a user-facing toggle.

  • Integrates gyroscope input into camera-hooks to drive pan (replacing pointer when enabled), adds vertical pan, and applies gyroscope-specific smoothing
  • Adds Zustand store useGyroscopeStore to track permission, enabled state, and orientation values
  • Implements useDeviceOrientation hook to request permissions, normalize/smooth orientation, persist preference, and reset calibration
  • Adds GyroscopeToggle component and wires it into footer-content (mobile) alongside social links for enabling/disabling the feature

Written by Cursor Bugbot for commit 4aba2bd. This will update automatically on new commits. Configure here.

@vercel

vercel Bot commented Jan 7, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
website-2k25 Ready Ready Preview Aug 14, 2026 9:17pm

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread src/hooks/use-device-orientation.ts Outdated
Comment thread src/hooks/use-device-orientation.ts
Comment thread src/hooks/use-device-orientation.ts
Comment thread src/hooks/use-device-orientation.ts
ragojose and others added 2 commits August 14, 2026 18:08
…ntrols

# Conflicts:
#	src/components/layout/footer-content.tsx
- Keep permission at "prompt" when the iOS dialog is dismissed
  ("default" result) so the user can retry instead of being locked out
- Only render the toggle on coarse-pointer devices; desktop browsers
  expose DeviceOrientationEvent without hardware and enabling the
  toggle there disabled mouse panning
- Replace the dual-label spans that relied on a nonexistent xs
  breakpoint with a single label
- Type requestPermission as a static on the constructor instead of
  augmenting the instance interface

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ragojose

Copy link
Copy Markdown
Member

Revived this PR and brought it up to date:

Merge: merged main in (80080f1) — only conflict was footer-content.tsx, resolved against the new year/socialLinks props from the Sanity migration. The camera-hooks changes applied cleanly since that file hasn't changed on main.

Fixes (e1c3108):

  • Permission retry: dismissing the iOS permission dialog ("default" result) now keeps the state at "prompt" instead of locking the toggle as denied — the user can tap again to retry.
  • Desktop gating: the toggle only renders on (pointer: coarse) devices. Desktop browsers expose DeviceOrientationEvent with no gyroscope hardware, so at mobile viewport widths the toggle could render and enabling it zeroed out mouse panning. The existing 500 ms hardware-detection for stale localStorage stays as a second line of defense.
  • Labels: the dual xs:-gated label spans relied on an xs breakpoint that doesn't exist in tailwind.config.ts (long label could never show) — replaced with a single Gyro on/off label.
  • Types: requestPermission is a static on the DeviceOrientationEvent constructor; typed it as such instead of augmenting the instance interface globally.

Verified: pnpm build (Next 16.3 / Turbopack) and lint pass on touched files; headless-browser check confirms the toggle is absent with a fine pointer, renders and toggles Gyro off → on → off (with localStorage persistence) under coarse-pointer emulation, and the home-page WebGL scene renders with no console errors.

Still needs a phone: real-device QA on the Vercel preview — iOS permission prompt flow, Android no-prompt path, and tuning feel of GYRO_PAN_HORIZONTAL/VERTICAL + GYRO_SMOOTHING. Known limitation kept out of scope: landscape orientation doesn't swap gamma/beta axes.

🤖 Generated with Claude Code

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.

2 participants