From 7630c6fc03d9dbf6e68d0b6e95188afd5352fff1 Mon Sep 17 00:00:00 2001 From: mkr Date: Thu, 30 Nov 2017 17:19:20 +0300 Subject: [PATCH] Patch for non-restricted zoom-in. --- src/GraphicsView/GraphicsView_ViewPort.cxx | 14 ++++++++++++-- src/GraphicsView/GraphicsView_ViewPort.h | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/GraphicsView/GraphicsView_ViewPort.cxx b/src/GraphicsView/GraphicsView_ViewPort.cxx index 627a30cdd..93e75b461 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.cxx +++ b/src/GraphicsView/GraphicsView_ViewPort.cxx @@ -149,7 +149,8 @@ GraphicsView_ViewPort::GraphicsView_ViewPort( QWidget* theParent ) myIsDragPositionInitialized( false ), myIsPulling( false ), myPullingObject( 0 ), - myStoredCursor( Qt::ArrowCursor ) + myStoredCursor( Qt::ArrowCursor ), + myZoomCoeff( 100 ) { // scene myScene = new GraphicsView_Scene( this ); @@ -888,7 +889,7 @@ void GraphicsView_ViewPort::zoom( double theX1, double theY1, double theX2, doub double aM22 = aTransform.m22(); // 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 ) + if( myZoomCoeff < 0 || qMax( aM11, aM22 ) < myZoomCoeff ) setTransform( aTransform ); myIsTransforming = false; @@ -1002,6 +1003,15 @@ void GraphicsView_ViewPort::applyTransform() anObject->setViewTransform( transform() ); } +//================================================================ +// Function : setZoomCoeff +// Purpose : +//================================================================ +void GraphicsView_ViewPort::setZoomCoeff( const int& theZoomCoeff ) +{ + myZoomCoeff = theZoomCoeff; +} + //================================================================ // Function : currentBlock // Purpose : diff --git a/src/GraphicsView/GraphicsView_ViewPort.h b/src/GraphicsView/GraphicsView_ViewPort.h index 8e53b1c5a..51b3f53de 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.h +++ b/src/GraphicsView/GraphicsView_ViewPort.h @@ -161,6 +161,9 @@ public: void applyTransform(); + int zoomCoeff() const { return myZoomCoeff; } + void setZoomCoeff( const int& theZoomCoeff ); + // block status BlockStatus currentBlock(); @@ -331,6 +334,9 @@ private: // cursor QCursor myStoredCursor; + + // zoom diagonal coefficient + int myZoomCoeff; }; Q_DECLARE_OPERATORS_FOR_FLAGS( GraphicsView_ViewPort::InteractionFlags ) -- 2.39.2