From: asl Date: Wed, 20 Sep 2017 11:34:07 +0000 (+0300) Subject: refs #1322: the zoom activated Ctrl+Left button is also centered by mouse position X-Git-Tag: v2.1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9ef29388e7930784213a4c96a0596c3e9fc46934;p=modules%2Fgui.git refs #1322: the zoom activated Ctrl+Left button is also centered by mouse position --- diff --git a/src/GraphicsView/GraphicsView_ViewPort.cxx b/src/GraphicsView/GraphicsView_ViewPort.cxx index dac64f7ce..40086a4f8 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.cxx +++ b/src/GraphicsView/GraphicsView_ViewPort.cxx @@ -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 ); } //================================================================