Repository navigation
Android: pinch to zoom the map through simulated WM_GESTURE - #3863
Merged
Merged
Conversation
Two fingers on the Android touch screen now send Windows touch gestures (XplatUIMine.SendGesture, in the mono submodule) instead of a mouse wheel notch each time the finger spread doubled or halved: - WinForms page: a second finger turns the touch into a pinch, sent as GID_BEGIN, GID_ZOOM (GF_BEGIN, updates, GF_END) and GID_END at the centre of the fingers with the distance between them. As on Windows, a touch is only promoted to the mouse once it moves, lifts or is held (500 ms), and fingers of a gesture send no mouse messages, so a pinch on the plan map no longer ends in a click that adds a waypoint. - myGMAP: the existing WM_GESTURE handler reads the gesture with the real GetGestureInfo on Windows and from the simulated handle under netstandard. The zoom now follows the finger spread from the start of the gesture (doubling it is one level) and keeps the point between the fingers under them, without the debug markers. A handled zoom is closed and not passed to DefWindowProc, which on Windows would also zoom again through the legacy Ctrl+mouse wheel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
CI note: two of the red checks aren't from this PR. Both fail the same way on
No fix exists for either yet, and they're outside this change, so I haven't widened the PR for them. The DotNet, Android and Linux builds are still running. Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pinch to zoom on the map, done the Windows way. Two fingers on the Android touch screen now send real
WM_GESTURE/GID_ZOOMmessages, and the map reads them as it would withGetGestureInfoon a Windows touch screen. This replaces the old pinch handling, which sent one mouse-wheel notch each time the finger spread doubled or halved.Changes
mono submodule → meee1/mono@708e58479a9 (
simulated-touch-gestures, on top ofnc-borders)WM_GESTURE/WM_GESTURENOTIFYtoMsg.XplatUIMine.SendGesturepostsWM_GESTURE(gesture id in wParam) to the control under the point where the gesture began, for every message of that gesture.HGESTUREINFO: an HGLOBAL holding aGESTUREINFOwith the Windows layout. The handler frees it when it handles the gesture.DefWndProcdoes whatDefWindowProcdoes on Windows. An unhandled gesture goes to the parent. At the top level, a zoom becomes the legacy Ctrl+mouse wheel (one notch per doubling or halving of the spread).WinForms.xaml.cs(Android touch input)GID_BEGIN,GID_ZOOM(GF_BEGIN, updates,GF_END) andGID_END, at the centre of the fingers with the distance between them.myGMAPWM_GESTUREhandler reads the gesture with the realGetGestureInfoon Windows (net472) and from the simulated handle under netstandard2.0.DefWindowProc. On Windows,DefWindowProcwould also zoom again through the legacy Ctrl+wheel.Testing
Pixel 7 API 35 emulator, Xamarin.Android Debug (x86_64), with two-finger pinches injected through the emulator console:
MissionPlanner.Controlsbuilds for net472 and netstandard2.0. Not tested on a real Windows touch screen.Known limitation
The zoom box on Flight Data / Plan only updates when the whole-number zoom level changes. GMap raises
OnMapZoomChangedfromZoomStep, so after a pinch it can show 4.0 while the map is at about 4.9. This is existing behaviour, and mouse-wheel zoom never hit it because it always lands on whole levels.🤖 Generated with Claude Code