git-svn-id: svn://db.shs.com.ru/libs@506 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -315,6 +315,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlockView" name="blockView">
|
||||
<property name="navigateAnimationEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="miniMap" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
||||
@@ -46,7 +46,7 @@ void BlockView::_init() {
|
||||
cur_scl = thumb_scl = prev_app_scale = 1.;
|
||||
_talpha = 0.;
|
||||
ae_enabled = is_block_anim = true;
|
||||
is_nav_anim = false;
|
||||
is_nav_anim = true;
|
||||
nav_prev_aa = nav_prev_imaa = nav_prev_grid = true;
|
||||
thumb_size = QSizeF(200, 200);
|
||||
if (scene() == 0) {
|
||||
@@ -667,7 +667,8 @@ void BlockView::wheelEvent(QWheelEvent * e) {
|
||||
//r.setHeight(r.height() * scl);
|
||||
r.setHeight(r.width() * vh / vw);
|
||||
r.translate(cx * (pw - r.width()), cy * (ph - r.height()));
|
||||
animateNav(r);
|
||||
animateNav(r, scl);
|
||||
//_setNav(r);
|
||||
return;
|
||||
}
|
||||
if (!wheel_zoom) QGraphicsView::wheelEvent(e);
|
||||
@@ -1620,26 +1621,31 @@ QList<QGraphicsItem * > BlockView::selectedDecors() const {
|
||||
}
|
||||
|
||||
|
||||
QRectF BlockView::_nav() const {
|
||||
return mapToScene(viewport()->rect()).boundingRect();
|
||||
}
|
||||
|
||||
|
||||
void BlockView::animateNav(QRectF d) {
|
||||
void BlockView::animateNav(QRectF d, double scl) {
|
||||
nav_target = d;
|
||||
if (is_nav_anim) {
|
||||
if (anim_el.elapsed() < 10 || (qAbs<double>(scl - 1.) <= 0.1)) {
|
||||
if (nav_anim.state() == QAbstractAnimation::Running) {
|
||||
nav_anim.stop();
|
||||
_navFinished();
|
||||
}
|
||||
_setNav(d);
|
||||
anim_el.restart();
|
||||
return;
|
||||
}
|
||||
if (nav_anim.state() != QAbstractAnimation::Running) {
|
||||
nav_prev_aa = renderHints().testFlag(QPainter::Antialiasing);
|
||||
nav_prev_imaa = renderHints().testFlag(QPainter::SmoothPixmapTransform);
|
||||
nav_prev_grid = isGridVisible();
|
||||
setRenderHint(QPainter::Antialiasing, false);
|
||||
setRenderHint(QPainter::Antialiasing, false);
|
||||
setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
setGridVisible(false);
|
||||
}
|
||||
nav_anim.stop();
|
||||
nav_anim.setStartValue(_nav());
|
||||
nav_anim.setEndValue(d);
|
||||
nav_anim.start();
|
||||
anim_el.restart();
|
||||
} else
|
||||
_setNav(d);
|
||||
}
|
||||
@@ -1815,7 +1821,19 @@ void BlockView::_setThumb(double v) {
|
||||
|
||||
|
||||
void BlockView::_setNav(QRectF v) {
|
||||
QGraphicsView::fitInView(v);
|
||||
//QGraphicsView::fitInView(v);
|
||||
double vw = viewport()->width(), vh = viewport()->height();
|
||||
if (vw < 1. || vh < 1. || v.isEmpty()) return;
|
||||
QTransform matrix;
|
||||
double scl = qMin(vw / v.width(), vh / v.height());
|
||||
matrix.scale(scl, scl);
|
||||
QGraphicsView::setTransform(matrix);
|
||||
QGraphicsView::centerOn(v.center());
|
||||
}
|
||||
|
||||
|
||||
QRectF BlockView::_nav() const {
|
||||
return mapToScene(viewport()->rect()).boundingRect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ protected:
|
||||
void hideTmpBuses(bool clear = true);
|
||||
double _thumb() const {return _talpha;}
|
||||
QRectF _nav() const;
|
||||
void animateNav(QRectF d);
|
||||
void animateNav(QRectF d, double scl = 0.);
|
||||
void scrollFromThumb();
|
||||
void deleteCopyTemp();
|
||||
void emitActionEvent(BlockItemBase::Action action, QList<QGraphicsItem * > items);
|
||||
@@ -188,6 +188,7 @@ protected:
|
||||
QWidget widget_thumb;
|
||||
Qt::KeyboardModifiers mm_mods;
|
||||
QPropertyAnimation thumb_anim, nav_anim;
|
||||
QTime anim_el;
|
||||
int timer_thumb, thumb_hide_delay, thick;
|
||||
bool mm_drag, new_bus, new_branch, moved, mm_cancel, iconnect, mm_copy, mm_thumb, ae_enabled, is_nav_anim, is_block_anim, move_bus_point;
|
||||
bool grid_visible, grid_snap, pm_connect, navigation, m_connect, m_trace_with_buses, m_pin_mc, minimap, prev_tcb, wheel_zoom;
|
||||
|
||||
Reference in New Issue
Block a user