From 9fcfec881cebbeb10290077cec3e4ba88ec15dd0 Mon Sep 17 00:00:00 2001 From: carlosah Date: Tue, 24 Oct 2023 15:20:10 +0100 Subject: [PATCH] 0033513: Visualization - Integration of the ability to zoom with vertical mouse movements Added a new gesture for zooming after vertical mouse movement - AIS_MouseGesture_ZoomVertical --- src/AIS/AIS_MouseGesture.hxx | 2 ++ src/AIS/AIS_ViewController.cxx | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/AIS/AIS_MouseGesture.hxx b/src/AIS/AIS_MouseGesture.hxx index b972e84451..b251a99b08 100644 --- a/src/AIS/AIS_MouseGesture.hxx +++ b/src/AIS/AIS_MouseGesture.hxx @@ -29,6 +29,8 @@ enum AIS_MouseGesture // AIS_MouseGesture_Zoom, //!< view zoom gesture; //! move mouse left to zoom-out, and to the right to zoom-in + AIS_MouseGesture_ZoomVertical, //!< view zoom gesture; + //! move mouse up to zoom-out, and to the down to zoom-in AIS_MouseGesture_ZoomWindow, //!< view zoom by window gesture; //! press button to start, move mouse to define rectangle, release to finish AIS_MouseGesture_Pan, //!< view panning gesture diff --git a/src/AIS/AIS_ViewController.cxx b/src/AIS/AIS_ViewController.cxx index 78e7007471..479972103b 100644 --- a/src/AIS/AIS_ViewController.cxx +++ b/src/AIS/AIS_ViewController.cxx @@ -843,6 +843,7 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint, } case AIS_MouseGesture_Zoom: case AIS_MouseGesture_ZoomWindow: + case AIS_MouseGesture_ZoomVertical: { if (!myToAllowZooming) { @@ -1043,6 +1044,7 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint, break; } case AIS_MouseGesture_Zoom: + case AIS_MouseGesture_ZoomVertical: { if (!myToAllowZooming) { @@ -1051,15 +1053,20 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint, const double aZoomTol = theIsEmulated ? double(myTouchToleranceScale) * myTouchZoomThresholdPx : 0.0; - if (double (Abs (aDelta.x())) > aZoomTol) + const double aScrollDelta = myMouseActiveGesture == AIS_MouseGesture_Zoom + ? aDelta.x() + : aDelta.y(); + if (Abs (aScrollDelta) > aZoomTol) { - UpdateZoom (Aspect_ScrollDelta (aDelta.x())); + if (UpdateZoom (Aspect_ScrollDelta (aScrollDelta))) + { + toUpdateView = true; + } myUI.Dragging.ToMove = true; myUI.Dragging.PointTo = thePoint; myMouseProgressPoint = thePoint; - toUpdateView = true; } break; }