]> OCCT Git - occt.git/commitdiff
0033513: Visualization - Integration of the ability to zoom with vertical mouse movements IR-2024-07-19
authorcarlosah <carlos.hernandez@opencascade.com>
Tue, 24 Oct 2023 14:20:10 +0000 (15:20 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Wed, 17 Jul 2024 11:52:16 +0000 (12:52 +0100)
Added a new gesture for zooming after vertical mouse movement - AIS_MouseGesture_ZoomVertical

src/AIS/AIS_MouseGesture.hxx
src/AIS/AIS_ViewController.cxx

index b972e84451eaf14db54b402492b5ae7096508a52..b251a99b08172b593a86a858c95658b76aff226e 100644 (file)
@@ -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
index 78e70074715c324d7c0caa53c61efcd7951d0e40..479972103b0bc48e8d9ebfb0f837f67f5ec936a5 100644 (file)
@@ -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;
     }