git-svn-id: svn://db.shs.com.ru/libs@512 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -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<QGraphicsItem * > BlockView::selectedDecors() const {
|
||||
void BlockView::animateNav(QRectF d, double scl) {
|
||||
nav_target = d;
|
||||
if (is_nav_anim) {
|
||||
if (qAbs<double>(scl - 1.) <= 0.1) {
|
||||
if (nav_anim.state() == QAbstractAnimation::Running) {
|
||||
nav_anim.stop();
|
||||
_navFinished();
|
||||
}
|
||||
if (qAbs<double>(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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user