Skip to content

feat(core): improve touch zoom gestures#10303

Open
charlieforward9 wants to merge 1 commit into
visgl:masterfrom
NEW-HEAT:codex/touch-zoom-gestures
Open

feat(core): improve touch zoom gestures#10303
charlieforward9 wants to merge 1 commit into
visgl:masterfrom
NEW-HEAT:codex/touch-zoom-gestures

Conversation

@charlieforward9
Copy link
Copy Markdown
Collaborator

@charlieforward9 charlieforward9 commented May 15, 2026

Summary

  • add one-finger double-tap-drag zoom gated by touchZoom
  • smooth noisy mobile pinch frames
  • stop pinch zoom exactly on touch lift instead of applying zoom inertia

Why

Mobile touch zoom could jump on noisy pinch-end frames. This keeps pinch zoom responsive while preventing the final lift frame from flicking the viewport, and adds the common double-tap-drag zoom gesture used by mobile map tools.

Split

GlobeView cursor/touch anchored zoom has been split into #10307 so this PR can stay focused on generic controller touch gesture behavior.

Tests

  • ./node_modules/.bin/vitest run --project browser test/modules/core/controllers/controllers.spec.ts
  • commit hook: module/test/example lint + prettier checks, lockfile validation, node vitest subset

@coveralls
Copy link
Copy Markdown

coveralls commented May 15, 2026

Coverage Status

coverage: 83.399% (-0.04%) from 83.434% — NEW-HEAT:codex/touch-zoom-gestures into visgl:master

Copy link
Copy Markdown
Collaborator

@felixpalmer felixpalmer left a comment

Choose a reason for hiding this comment

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

In general combining more separate features in a PR isn't a good idea, it makes it harder to review and test.

I'm also not convinced that the zoom to pointer location is necessarily a better behavior, the globe can sometimes make jerky movements and if you start the zoom outside the globe it "latches on" to the interaction point when the globe hits that point. Perhaps a controller option?

return true;
}

protected _onPointerDown(event: MjolnirEvent): boolean {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This code feels very low level and should go in mjolnir, WDYT @Pessimistress ?

];
}

getGlobeRayDistanceRatio(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like an LLM just copied this out of the unproject method


const currentAtPixel = this.unproject(pixel);
const edgeT = Math.max(0, Math.min(1, (distanceRatio - 0.75) / 0.25));
const anchorStrength = 1 - edgeT * 0.65;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Magic numbers here and the function name is misleading and easy to confuse with existing panByPosition

@charlieforward9
Copy link
Copy Markdown
Collaborator Author

The pointer-anchored globe zoom is intended to match Google Earth standard behavior: zooming preserves the point under the cursor/touch instead of always zooming around the viewport center.\n\nThat said, agreed that this PR currently combines too many review surfaces. I’m going to split it up so the generic touch zoom gesture work and the globe anchored zoom behavior can be reviewed independently.

@charlieforward9 charlieforward9 force-pushed the codex/touch-zoom-gestures branch from 9e60bce to 335b614 Compare May 16, 2026 17:31
@charlieforward9 charlieforward9 changed the title feat(core): improve touch zoom interactions feat(core): improve touch zoom gestures May 16, 2026
@charlieforward9
Copy link
Copy Markdown
Collaborator Author

Split is done:

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.

3 participants