Fix virtual joysticks triggering pinch-to-zoom on map#14396
Fix virtual joysticks triggering pinch-to-zoom on map#14396DonLakeFlyer wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (25.45%) is below the target coverage (30.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #14396 +/- ##
==========================================
- Coverage 25.47% 25.45% -0.02%
==========================================
Files 769 769
Lines 65912 66244 +332
Branches 30495 30640 +145
==========================================
+ Hits 16788 16863 +75
- Misses 37285 37410 +125
- Partials 11839 11971 +132
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
0b533d1 to
eeb22e2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
src/FlightMap/FlightMap.qml:193
- When a drag is converted into a pinch,
dragActiveis cleared without emittingmapPanStop().FlyViewMap.qmlrelies on the start/stop pair to restartpanRecenterTimer; after a user pans and then adds a second finger, vehicle tracking can remain disabled indefinitely because the final release takes thepinchActivepath and never sends the stop signal.
pinchActive = true
wasMultiTouch = true
dragActive = false
pinchStartDist = pinchDistance()
src/FlightMap/FlightMap.qml:203
- The new pinch zoom path no longer clamps the computed zoom level to a non-negative value. Pinching inward can drive
pinchStartZoom + Math.log2(scale)below zero (or to-Infinityif the distance collapses), unlike the removed PinchHandler and the WheelHandler path, and that invalid zoom can also be persisted throughflightMapZoom.
if (pinchStartDist > 0) {
let scale = currentDist / pinchStartDist
_map.zoomLevel = pinchStartZoom + Math.log2(scale)
| // Pinch-to-zoom is also handled here rather than via PinchHandler to prevent the handler from stealing | ||
| // touch grabs from items above (e.g. virtual joystick pads). See GitHub issue #13450. | ||
| MultiPointTouchArea { |
There was a problem hiding this comment.
I need to test this on my laptop...
Restrict the map's PinchHandler grabPermissions so it cannot steal touch grabs from MultiPointTouchArea items (the joystick thumb pads). Previously, when both thumbs were on the virtual joysticks simultaneously, the PinchHandler's default CanTakeOverFromItems permission allowed it to interpret the two touch points as a pinch gesture and zoom the map instead of letting the joysticks operate independently. Fixes mavlink#13450
eeb22e2 to
aa55176
Compare
Build ResultsPlatform Status
All builds passed. Pre-commit
Pre-commit hooks: 4 passed, 45 failed, 7 skipped. Test Resultslinux-coverage: 90 passed, 0 skipped Code CoverageCoverage: 59.4% No baseline available for comparison Artifact Sizes
Updated: 2026-05-17 17:33:50 UTC • Triggered by: Android |
|
Need to test this more on laptops... |
Fixes #13450
Problem
When both thumbs are on the virtual joysticks simultaneously on mobile, the map's
PinchHandlersteals the touch grabs from the joystickMultiPointTouchAreaitems and interprets them as a pinch-to-zoom gesture.Root Cause
The
PinchHandlerinFlightMap.qmlused the defaultgrabPermissionswhich includesCanTakeOverFromItems. This allows it to steal exclusive grabs thatMultiPointTouchArea(an Item-based touch handler) already holds on its touch points.Fix
Set
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfDifferentTypeon thePinchHandler. This prevents it from stealing grabs from Items (likeMultiPointTouchAreain the joystick pads) while still allowing normal pinch-to-zoom when fingers land directly on the map.