[Marble-commits] KDE/kdeedu/marble/src/lib
Dennis Nienhüser
earthwings at gentoo.org
Fri Apr 30 23:25:58 CEST 2010
SVN commit 1121227 by nienhueser:
Be aware of animations in wheel zoom mode and prevent interpolated positions to slow down zooming.
M +12 -2 MarbleWidgetInputHandler.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetInputHandler.cpp #1121226:1121227
@@ -58,6 +58,7 @@
bool m_positionSignalConnected;
QTimer *m_mouseWheelTimer;
Qt::MouseButtons m_disabledMouseButtons;
+ qreal m_wheelZoomTargetDistance;
};
MarbleWidgetInputHandler::Protected::Protected()
@@ -65,7 +66,8 @@
m_model( 0 ),
m_positionSignalConnected( false ),
m_mouseWheelTimer( 0 ),
- m_disabledMouseButtons( Qt::NoButton )
+ m_disabledMouseButtons( Qt::NoButton ),
+ m_wheelZoomTargetDistance( 0.0 )
{
}
@@ -323,6 +325,7 @@
}
d->m_widget->map()->viewParams()->viewport()->resetFocusPoint();
+ d->m_wheelZoomTargetDistance = 0.0;
}
void MarbleWidgetInputHandler::installPluginEventFilter( RenderPlugin *renderPlugin )
@@ -726,7 +729,14 @@
marbleWidget->setViewContext( Animation );
int steps = wheelevt->delta() / 3;
- qreal newDistance = marbleWidget->map()->distanceFromZoom(marbleWidget->map()->zoom() + steps);
+ qreal zoom = marbleWidget->map()->zoom();
+ qreal target = MarbleWidgetInputHandler::d->m_wheelZoomTargetDistance;
+ if ( marbleWidget->animationsEnabled() && target > 0.0 ) {
+ // Do not use intermediate (interpolated) distance values caused by animations
+ zoom = marbleWidget->map()->zoomFromDistance( target );
+ }
+ qreal newDistance = marbleWidget->map()->distanceFromZoom( zoom + steps );
+ MarbleWidgetInputHandler::d->m_wheelZoomTargetDistance = newDistance;
d->ZoomAt(MarbleWidgetInputHandler::d->m_widget, wheelevt->pos(), newDistance);
MarbleWidgetInputHandler::d->m_mouseWheelTimer->start( 400 );
More information about the Marble-commits
mailing list