]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
refs #1322: the zoom activated Ctrl+Left button is also centered by mouse position
authorasl <asl@opencascade.com>
Wed, 20 Sep 2017 11:34:07 +0000 (14:34 +0300)
committerasl <asl@opencascade.com>
Wed, 20 Sep 2017 11:34:07 +0000 (14:34 +0300)
src/GraphicsView/GraphicsView_ViewPort.cxx

index dac64f7ceedc12f3b3b784277a701824bb833471..40086a4f8c9754e8b4a0bed8a673c5db99d75643 100644 (file)
@@ -850,6 +850,11 @@ void GraphicsView_ViewPort::zoom( double theX1, double theY1, double theX2, doub
   aTransform.scale( aZoom, aZoom );
   double aM11 = aTransform.m11();
   double aM22 = aTransform.m22();
+
+
+  QGraphicsView::ViewportAnchor old_anchor = transformationAnchor();
+  setTransformationAnchor( QGraphicsView::AnchorUnderMouse );
+
   // increasing of diagonal coefficients (>300) leads to a crash sometimes
   // at the values of 100 some primitives are drawn incorrectly
   if( qMax( aM11, aM22 ) < 100 )
@@ -858,6 +863,8 @@ void GraphicsView_ViewPort::zoom( double theX1, double theY1, double theX2, doub
   myIsTransforming = false;
 
   applyTransform();
+
+  setTransformationAnchor( old_anchor );
 }
 
 //================================================================