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.setTargetObject(this);
|
||||||
nav_anim.setPropertyName("_nav");
|
nav_anim.setPropertyName("_nav");
|
||||||
nav_anim.setEasingCurve(QEasingCurve::Linear);
|
nav_anim.setEasingCurve(QEasingCurve::Linear);
|
||||||
nav_anim.setDuration(200);
|
nav_anim.setDuration(150);
|
||||||
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(checkPaste()));
|
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(checkPaste()));
|
||||||
connect(&nav_anim, SIGNAL(finished()), this, SLOT(_navFinished()));
|
connect(&nav_anim, SIGNAL(finished()), this, SLOT(_navFinished()));
|
||||||
connect(scene_, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustThumb()));
|
connect(scene_, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustThumb()));
|
||||||
connect(scene_, SIGNAL(selectionChanged()), this, SLOT(sceneSelectionChanged()));
|
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());
|
centerOn(scene_->sceneRect().center());
|
||||||
setCacheMode(CacheBackground);
|
setCacheMode(CacheBackground);
|
||||||
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||||
@@ -1651,11 +1649,7 @@ QList<QGraphicsItem * > BlockView::selectedDecors() const {
|
|||||||
void BlockView::animateNav(QRectF d, double scl) {
|
void BlockView::animateNav(QRectF d, double scl) {
|
||||||
nav_target = d;
|
nav_target = d;
|
||||||
if (is_nav_anim) {
|
if (is_nav_anim) {
|
||||||
if (qAbs<double>(scl - 1.) <= 0.1) {
|
if (qAbs<double>(scl - 1.) <= 0.1 && (nav_anim.state() != QAbstractAnimation::Running)) {
|
||||||
if (nav_anim.state() == QAbstractAnimation::Running) {
|
|
||||||
nav_anim.stop();
|
|
||||||
_navFinished();
|
|
||||||
}
|
|
||||||
_setNav(d);
|
_setNav(d);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1851,11 +1845,12 @@ void BlockView::_setNav(QRectF v) {
|
|||||||
QTransform matrix;
|
QTransform matrix;
|
||||||
double scl = qMin(vw / v.width(), vh / v.height());
|
double scl = qMin(vw / v.width(), vh / v.height());
|
||||||
double ascl = appScale(this);
|
double ascl = appScale(this);
|
||||||
scl = qMin(qMax(scl, 0.02 * ascl), 50. * ascl);
|
if (scl > 0.02 * ascl && scl < 50.0 * ascl) {
|
||||||
matrix.scale(scl, scl);
|
matrix.scale(scl, scl);
|
||||||
nav_rect = v;
|
nav_rect = v;
|
||||||
QGraphicsView::setTransform(matrix);
|
QGraphicsView::setTransform(matrix);
|
||||||
QGraphicsView::centerOn(v.center());
|
QGraphicsView::centerOn(v.center());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void _init();
|
void _init();
|
||||||
void _updateBack();
|
void _updateBack();
|
||||||
|
void updateNavRect();
|
||||||
bool event(QEvent * e);
|
bool event(QEvent * e);
|
||||||
bool eventFilter(QObject * o, QEvent * e);
|
bool eventFilter(QObject * o, QEvent * e);
|
||||||
void stopTimer(int & tid);
|
void stopTimer(int & tid);
|
||||||
@@ -207,7 +208,6 @@ protected slots:
|
|||||||
void removedBlock(QObject * o);
|
void removedBlock(QObject * o);
|
||||||
void removeJunk();
|
void removeJunk();
|
||||||
void sceneSelectionChanged();
|
void sceneSelectionChanged();
|
||||||
void updateNavRect();
|
|
||||||
void _setThumb(double v);
|
void _setThumb(double v);
|
||||||
void _setNav(QRectF v);
|
void _setNav(QRectF v);
|
||||||
void _navFinished();
|
void _navFinished();
|
||||||
|
|||||||
Reference in New Issue
Block a user