feat(core): improve touch zoom gestures#10303
Conversation
felixpalmer
left a comment
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
This code feels very low level and should go in mjolnir, WDYT @Pessimistress ?
| ]; | ||
| } | ||
|
|
||
| getGlobeRayDistanceRatio( |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Magic numbers here and the function name is misleading and easy to confuse with existing panByPosition
|
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. |
9e60bce to
335b614
Compare
|
Split is done:
|
Summary
touchZoomWhy
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