Skip to content

fix(terrain-viewer): use Pointer Lock for drag pan and tilt#195

Closed
kui wants to merge 1 commit into
masterfrom
worktree-wt-pointer-lock
Closed

fix(terrain-viewer): use Pointer Lock for drag pan and tilt#195
kui wants to merge 1 commit into
masterfrom
worktree-wt-pointer-lock

Conversation

@kui

@kui kui commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Drag-pan (left button) and drag-tilt (middle button) accumulate movementX/Y, but once the OS cursor reaches the window edge no more motion is delivered and the drag stalls.
  • Acquire Pointer Lock on mousedown for the left or middle button, and release it on mouseup when neither button is held. A document-level mouseup listener guarantees cleanup if Pointer Lock is dropped externally (Escape key, focus loss).

Test plan

  • deno task ci:fmt-check
  • deno task ci:lint
  • deno task ci:type-check
  • deno task test
  • Manual: drag-pan past the canvas edge in the terrain viewer and confirm camera keeps moving instead of stalling; verify the cursor reappears on release.

Without Pointer Lock, drag-pan and drag-tilt stall once the cursor
reaches the window edge because the OS clamps further pointer
movement. Request Pointer Lock on left/middle mousedown so movementX/Y
keeps flowing regardless of cursor position, and release the lock once
no relevant button remains pressed. Document-level mouseup also cleans
up if the browser drops the lock unexpectedly.
@kui kui closed this Jun 30, 2026
@kui
kui deleted the worktree-wt-pointer-lock branch June 30, 2026 04:51
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