diff -r 16a8ef1d82b2 -r f076fdec767d mapeditor.cpp --- a/mapeditor.cpp Fri Oct 02 09:40:57 2009 +0000 +++ b/mapeditor.cpp Fri Oct 02 13:24:55 2009 +0000 @@ -185,7 +185,7 @@ return mapScene; } -void MapEditor::scrollTo (const QModelIndex &index) //FIXME-1 problems with locating stuff in big maps +void MapEditor::scrollTo (const QModelIndex &index) { if (index.isValid()) { @@ -196,7 +196,8 @@ if (lmo) { QRectF r=lmo->getBBox(); - setScrollBarPosTarget (lmo->getBBox() ); + if (debug) cout << "ME::scrollTo "<getHeadingStd()<<" bbox="<value(); qreal bottom = top + height; + scrollBarPosTarget=getScrollBarPos(); + if (viewRect.left() <= left + xmargin) { // need to scroll from the left // if (!d->leftIndent) @@ -237,17 +240,24 @@ scrollBarPosTarget.setY(int(viewRect.bottom() - height + ymargin + 0.5)); } + if (scrollBarPosTarget==getScrollBarPos()) return; + if (scrollBarPosAnimation.state()==QtAbstractAnimation::Running) scrollBarPosAnimation.stop(); - scrollBarPosAnimation.setTargetObject (this); - scrollBarPosAnimation.setPropertyName ("scrollBarPos"); - scrollBarPosAnimation.setDuration(1000); - scrollBarPosAnimation.setEasingCurve ( QtEasingCurve::OutQuint); - scrollBarPosAnimation.setStartValue( - QPointF (horizontalScrollBar()->value() , - verticalScrollBar()->value() ) ); - scrollBarPosAnimation.setEndValue(scrollBarPosTarget); - scrollBarPosAnimation.start(); + + if (settings.value ("/animation/use/",true).toBool() ) + { + scrollBarPosAnimation.setTargetObject (this); + scrollBarPosAnimation.setPropertyName ("scrollBarPos"); + scrollBarPosAnimation.setDuration(1000); + scrollBarPosAnimation.setEasingCurve ( QtEasingCurve::OutQuint); + scrollBarPosAnimation.setStartValue( + QPointF (horizontalScrollBar()->value() , + verticalScrollBar()->value() ) ); + scrollBarPosAnimation.setEndValue(scrollBarPosTarget); + scrollBarPosAnimation.start(); + } else + setScrollBarPos (scrollBarPosTarget); } QPointF MapEditor::getScrollBarPosTarget() @@ -265,7 +275,8 @@ QPointF MapEditor::getScrollBarPos() { - return scrollBarPos; + return QPointF (horizontalScrollBar()->value(),verticalScrollBar()->value()); + //return scrollBarPos; } void MapEditor::setZoomFactorTarget (const qreal &zft) @@ -273,14 +284,18 @@ zoomFactorTarget=zft; if (zoomAnimation.state()==QtAbstractAnimation::Running) zoomAnimation.stop(); - //zoomAnimation=QtPropertyAnimation(this, "zoomFactor"); - zoomAnimation.setTargetObject (this); - zoomAnimation.setPropertyName ("zoomFactor"); - zoomAnimation.setDuration(1000); - zoomAnimation.setEasingCurve ( QtEasingCurve::OutQuint); - zoomAnimation.setStartValue(zoomFactor); - zoomAnimation.setEndValue(zft); - zoomAnimation.start(); + if (settings.value ("/animation/use/",true).toBool() ) + { + //zoomAnimation=QtPropertyAnimation(this, "zoomFactor"); + zoomAnimation.setTargetObject (this); + zoomAnimation.setPropertyName ("zoomFactor"); + zoomAnimation.setDuration(1000); + zoomAnimation.setEasingCurve ( QtEasingCurve::OutQuint); + zoomAnimation.setStartValue(zoomFactor); + zoomAnimation.setEndValue(zft); + zoomAnimation.start(); + } else + setZoomFactor (zft); } qreal MapEditor::getZoomFactorTarget() @@ -1483,7 +1498,12 @@ void MapEditor::mouseDoubleClickEvent(QMouseEvent* e) { - if (debug) cout << "ME p="<pos())<