From bd697d293f9f6e45a0125e8cef67baa860ce31bc Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Sun, 5 Jul 2026 20:18:58 -0500 Subject: [PATCH] Fix: enable pinch-to-zoom on precision touchpads PointerWheelAction only checked the physical keyboard Ctrl state (Utils.IsKeyPressed) to decide whether a wheel event is a zoom gesture. A precision-touchpad pinch arrives as a Ctrl-modified wheel where the Control flag is on the event's KeyModifiers, not the keyboard state, so pinch gestures were ignored. Also check e.KeyModifiers.HasFlag(VirtualKeyModifiers.Control). --- TextControlBox/Core/PointerActionsManager.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/TextControlBox/Core/PointerActionsManager.cs b/TextControlBox/Core/PointerActionsManager.cs index 9d63bce..2e21a8f 100644 --- a/TextControlBox/Core/PointerActionsManager.cs +++ b/TextControlBox/Core/PointerActionsManager.cs @@ -428,8 +428,11 @@ public void PointerWheelAction(ZoomManager zoomManager, PointerRoutedEventArgs e { var delta = e.GetCurrentPoint(coreTextbox.canvasSelection).Properties.MouseWheelDelta; bool needsUpdate = false; - //Zoom using mousewheel - if (Utils.IsKeyPressed(VirtualKey.Control)) + //Zoom using mousewheel or a precision-touchpad pinch. A pinch gesture is delivered by + //Windows as a Ctrl-modified wheel, but that Control comes from the wheel message + //(e.KeyModifiers), not the physical keyboard state, so Utils.IsKeyPressed alone misses it. + //Check both so pinch-to-zoom works on precision touchpads. + if (Utils.IsKeyPressed(VirtualKey.Control) || e.KeyModifiers.HasFlag(VirtualKeyModifiers.Control)) { zoomManager._ZoomFactor += delta / 20; zoomManager.UpdateZoom();