diff --git a/qad/blockview/blockview.cpp b/qad/blockview/blockview.cpp index 6e8a460..53b1a22 100644 --- a/qad/blockview/blockview.cpp +++ b/qad/blockview/blockview.cpp @@ -71,13 +71,11 @@ void BlockView::_init() { nav_anim.setTargetObject(this); nav_anim.setPropertyName("_nav"); nav_anim.setEasingCurve(QEasingCurve::Linear); - nav_anim.setDuration(200); + nav_anim.setDuration(150); connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(checkPaste())); connect(&nav_anim, SIGNAL(finished()), this, SLOT(_navFinished())); connect(scene_, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustThumb())); connect(scene_, SIGNAL(selectionChanged()), this, SLOT(sceneSelectionChanged())); - connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(updateNavRect())); - connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(updateNavRect())); centerOn(scene_->sceneRect().center()); setCacheMode(CacheBackground); setTransformationAnchor(QGraphicsView::AnchorUnderMouse); @@ -1651,11 +1649,7 @@ QList BlockView::selectedDecors() const { void BlockView::animateNav(QRectF d, double scl) { nav_target = d; if (is_nav_anim) { - if (qAbs(scl - 1.) <= 0.1) { - if (nav_anim.state() == QAbstractAnimation::Running) { - nav_anim.stop(); - _navFinished(); - } + if (qAbs(scl - 1.) <= 0.1 && (nav_anim.state() != QAbstractAnimation::Running)) { _setNav(d); return; } @@ -1851,11 +1845,12 @@ void BlockView::_setNav(QRectF v) { QTransform matrix; double scl = qMin(vw / v.width(), vh / v.height()); double ascl = appScale(this); - scl = qMin(qMax(scl, 0.02 * ascl), 50. * ascl); - matrix.scale(scl, scl); - nav_rect = v; - QGraphicsView::setTransform(matrix); - QGraphicsView::centerOn(v.center()); + if (scl > 0.02 * ascl && scl < 50.0 * ascl) { + matrix.scale(scl, scl); + nav_rect = v; + QGraphicsView::setTransform(matrix); + QGraphicsView::centerOn(v.center()); + } } diff --git a/qad/blockview/blockview.h b/qad/blockview/blockview.h index d1ede0b..0c25998 100644 --- a/qad/blockview/blockview.h +++ b/qad/blockview/blockview.h @@ -112,6 +112,7 @@ public: protected: void _init(); void _updateBack(); + void updateNavRect(); bool event(QEvent * e); bool eventFilter(QObject * o, QEvent * e); void stopTimer(int & tid); @@ -207,7 +208,6 @@ protected slots: void removedBlock(QObject * o); void removeJunk(); void sceneSelectionChanged(); - void updateNavRect(); void _setThumb(double v); void _setNav(QRectF v); void _navFinished();