1.1 --- a/mapeditor.cpp Fri Oct 02 09:40:57 2009 +0000
1.2 +++ b/mapeditor.cpp Fri Oct 02 13:24:55 2009 +0000
1.3 @@ -185,7 +185,7 @@
1.4 return mapScene;
1.5 }
1.6
1.7 -void MapEditor::scrollTo (const QModelIndex &index) //FIXME-1 problems with locating stuff in big maps
1.8 +void MapEditor::scrollTo (const QModelIndex &index)
1.9 {
1.10 if (index.isValid())
1.11 {
1.12 @@ -196,7 +196,8 @@
1.13 if (lmo)
1.14 {
1.15 QRectF r=lmo->getBBox();
1.16 - setScrollBarPosTarget (lmo->getBBox() );
1.17 + if (debug) cout << "ME::scrollTo "<<ti->getHeadingStd()<<" bbox="<<r<<endl;
1.18 + setScrollBarPosTarget (r);
1.19 }
1.20 }
1.21 }
1.22 @@ -216,6 +217,8 @@
1.23 qreal top = verticalScrollBar()->value();
1.24 qreal bottom = top + height;
1.25
1.26 + scrollBarPosTarget=getScrollBarPos();
1.27 +
1.28 if (viewRect.left() <= left + xmargin) {
1.29 // need to scroll from the left
1.30 // if (!d->leftIndent)
1.31 @@ -237,17 +240,24 @@
1.32 scrollBarPosTarget.setY(int(viewRect.bottom() - height + ymargin + 0.5));
1.33 }
1.34
1.35 + if (scrollBarPosTarget==getScrollBarPos()) return;
1.36 +
1.37 if (scrollBarPosAnimation.state()==QtAbstractAnimation::Running)
1.38 scrollBarPosAnimation.stop();
1.39 - scrollBarPosAnimation.setTargetObject (this);
1.40 - scrollBarPosAnimation.setPropertyName ("scrollBarPos");
1.41 - scrollBarPosAnimation.setDuration(1000);
1.42 - scrollBarPosAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
1.43 - scrollBarPosAnimation.setStartValue(
1.44 - QPointF (horizontalScrollBar()->value() ,
1.45 - verticalScrollBar()->value() ) );
1.46 - scrollBarPosAnimation.setEndValue(scrollBarPosTarget);
1.47 - scrollBarPosAnimation.start();
1.48 +
1.49 + if (settings.value ("/animation/use/",true).toBool() )
1.50 + {
1.51 + scrollBarPosAnimation.setTargetObject (this);
1.52 + scrollBarPosAnimation.setPropertyName ("scrollBarPos");
1.53 + scrollBarPosAnimation.setDuration(1000);
1.54 + scrollBarPosAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
1.55 + scrollBarPosAnimation.setStartValue(
1.56 + QPointF (horizontalScrollBar()->value() ,
1.57 + verticalScrollBar()->value() ) );
1.58 + scrollBarPosAnimation.setEndValue(scrollBarPosTarget);
1.59 + scrollBarPosAnimation.start();
1.60 + } else
1.61 + setScrollBarPos (scrollBarPosTarget);
1.62 }
1.63
1.64 QPointF MapEditor::getScrollBarPosTarget()
1.65 @@ -265,7 +275,8 @@
1.66
1.67 QPointF MapEditor::getScrollBarPos()
1.68 {
1.69 - return scrollBarPos;
1.70 + return QPointF (horizontalScrollBar()->value(),verticalScrollBar()->value());
1.71 + //return scrollBarPos;
1.72 }
1.73
1.74 void MapEditor::setZoomFactorTarget (const qreal &zft)
1.75 @@ -273,14 +284,18 @@
1.76 zoomFactorTarget=zft;
1.77 if (zoomAnimation.state()==QtAbstractAnimation::Running)
1.78 zoomAnimation.stop();
1.79 - //zoomAnimation=QtPropertyAnimation(this, "zoomFactor");
1.80 - zoomAnimation.setTargetObject (this);
1.81 - zoomAnimation.setPropertyName ("zoomFactor");
1.82 - zoomAnimation.setDuration(1000);
1.83 - zoomAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
1.84 - zoomAnimation.setStartValue(zoomFactor);
1.85 - zoomAnimation.setEndValue(zft);
1.86 - zoomAnimation.start();
1.87 + if (settings.value ("/animation/use/",true).toBool() )
1.88 + {
1.89 + //zoomAnimation=QtPropertyAnimation(this, "zoomFactor");
1.90 + zoomAnimation.setTargetObject (this);
1.91 + zoomAnimation.setPropertyName ("zoomFactor");
1.92 + zoomAnimation.setDuration(1000);
1.93 + zoomAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
1.94 + zoomAnimation.setStartValue(zoomFactor);
1.95 + zoomAnimation.setEndValue(zft);
1.96 + zoomAnimation.start();
1.97 + } else
1.98 + setZoomFactor (zft);
1.99 }
1.100
1.101 qreal MapEditor::getZoomFactorTarget()
1.102 @@ -1483,7 +1498,12 @@
1.103
1.104 void MapEditor::mouseDoubleClickEvent(QMouseEvent* e)
1.105 {
1.106 - if (debug) cout << "ME p="<<mapToScene (e->pos())<<endl;
1.107 + if (debug)
1.108 + {
1.109 + cout << "ME p="<<mapToScene (e->pos())<<" scrollBarPos="<<getScrollBarPos();
1.110 + cout << " min="<<QPointF(horizontalScrollBar()->minimum(),verticalScrollBar()->minimum());
1.111 + cout << endl;
1.112 + }
1.113
1.114
1.115 if (model->isSelectionBlocked() )