[Marble-commits] KDE/kdeedu/marble/src/lib
Torsten Rahn
tackat at kde.org
Wed Jan 6 22:52:40 CET 2010
SVN commit 1070837 by rahn:
BUG 177591
Initial fix by Mattias Dalkvist and Dennis Nienhüser. This is neat! :-)
M +26 -2 MarbleWidgetInputHandler.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetInputHandler.cpp #1070836:1070837
@@ -591,11 +591,35 @@
}
else {
if ( e->type() == QEvent::Wheel ) {
+ MarbleWidget *marbleWidget = MarbleWidgetInputHandler::d->m_widget;
// FIXME: disable animation quality after some time
- MarbleWidgetInputHandler::d->m_widget->setViewContext( Marble::Animation );
+ marbleWidget->setViewContext( Marble::Animation );
QWheelEvent *wheelevt = static_cast<QWheelEvent*>( e );
- MarbleWidgetInputHandler::d->m_widget->zoomViewBy( (int)(wheelevt->delta() / 3) );
+
+ qreal destLat;
+ qreal destLon;
+ bool isValid = marbleWidget->geoCoordinates(wheelevt->x(), wheelevt->y(),
+ destLon, destLat, GeoDataCoordinates::Radian );
+
+ marbleWidget->setUpdatesEnabled( false );
+ marbleWidget->zoomViewBy( (int)(wheelevt->delta() / 3) );
+
+ qreal mouseLat;
+ qreal mouseLon;
+ isValid = isValid && marbleWidget->geoCoordinates(wheelevt->x(), wheelevt->y(),
+ mouseLon, mouseLat, GeoDataCoordinates::Radian );
+
+ qreal centerLat = DEG2RAD * marbleWidget->centerLatitude();
+ qreal centerLon = DEG2RAD * marbleWidget->centerLongitude();
+
+ if ( isValid ) {
+ qreal lon = destLon - (mouseLon - centerLon);
+ qreal lat = destLat - (mouseLat - centerLat);
+ marbleWidget->centerOn( RAD2DEG * lon, RAD2DEG * lat );
+ }
+ marbleWidget->setUpdatesEnabled( true );
+
MarbleWidgetInputHandler::d->m_mouseWheelTimer->start( 400 );
return true;
}
More information about the Marble-commits
mailing list