From 892bd861bbe34352b58e6472ef457ef5f0d12848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Mon, 4 Mar 2019 15:01:30 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/libs@512 a8b55f48-bf90-11e4-a774-851b48703e85 --- qad/blockview/blockview.cpp | 21 ++++++++------------- qad/blockview/blockview.h | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) 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();