diff --git a/src/lib/marble/MarbleInputHandler.h b/src/lib/marble/MarbleInputHandler.h --- a/src/lib/marble/MarbleInputHandler.h +++ b/src/lib/marble/MarbleInputHandler.h @@ -76,6 +76,9 @@ */ bool inertialEarthRotationEnabled() const; + /// should the map do kinetic scrolling, this would stop the operation + virtual void stopInertialEarthRotation(); + Q_SIGNALS: // Mouse button menus void lmbRequest( int, int ); @@ -124,6 +127,8 @@ explicit MarbleDefaultInputHandler( MarbleAbstractPresenter* marblePresenter); ~MarbleDefaultInputHandler() override; + void stopInertialEarthRotation() override; + protected: bool eventFilter( QObject *, QEvent * ) override; bool handleMouseEvent(QMouseEvent *e); diff --git a/src/lib/marble/MarbleInputHandler.cpp b/src/lib/marble/MarbleInputHandler.cpp --- a/src/lib/marble/MarbleInputHandler.cpp +++ b/src/lib/marble/MarbleInputHandler.cpp @@ -127,6 +127,10 @@ return d->m_inertialEarthRotation; } +void MarbleInputHandler::stopInertialEarthRotation() +{ +} + class Q_DECL_HIDDEN MarbleDefaultInputHandler::Private { public: @@ -248,6 +252,11 @@ delete d; } +void MarbleDefaultInputHandler::stopInertialEarthRotation() +{ + d->m_kineticSpinning.stop(); +} + void MarbleDefaultInputHandler::lmbTimeout() { if (!selectionRubber()->isVisible()) @@ -929,28 +938,35 @@ bool handled = true; switch ( event->key() ) { case Qt::Key_Left: + stopInertialEarthRotation(); marblePresenter->moveByStep(-1, 0); break; case Qt::Key_Right: + stopInertialEarthRotation(); marblePresenter->moveByStep(1, 0); break; case Qt::Key_Up: + stopInertialEarthRotation(); marblePresenter->moveByStep(0, -1); break; case Qt::Key_Down: + stopInertialEarthRotation(); marblePresenter->moveByStep(0, 1); break; case Qt::Key_Plus: if (event->modifiers() != Qt::ControlModifier) { + stopInertialEarthRotation(); marblePresenter->zoomIn(); } break; case Qt::Key_Minus: if (event->modifiers() != Qt::ControlModifier) { + stopInertialEarthRotation(); marblePresenter->zoomOut(); } break; case Qt::Key_Home: + stopInertialEarthRotation(); marblePresenter->goHome(); break; default: diff --git a/src/lib/marble/MarbleWidget.cpp b/src/lib/marble/MarbleWidget.cpp --- a/src/lib/marble/MarbleWidget.cpp +++ b/src/lib/marble/MarbleWidget.cpp @@ -529,64 +529,76 @@ void MarbleWidget::setZoom( int newZoom, FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.setZoom( newZoom, mode ); } void MarbleWidget::zoomView( int zoom, FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.zoomView( zoom, mode ); } void MarbleWidget::zoomViewBy( int zoomStep, FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.zoomViewBy( zoomStep, mode ); } void MarbleWidget::zoomIn( FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.zoomIn( mode ); } void MarbleWidget::zoomOut( FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.zoomOut( mode ); } void MarbleWidget::rotateBy( const qreal deltaLon, const qreal deltaLat, FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.rotateBy( deltaLon, deltaLat, mode ); } void MarbleWidget::centerOn( const qreal lon, const qreal lat, bool animated ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.centerOn( lon, lat, animated ); } void MarbleWidget::centerOn( const GeoDataCoordinates &position, bool animated ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.centerOn( position, animated ); } void MarbleWidget::centerOn( const GeoDataLatLonBox &box, bool animated ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.centerOn( box, animated ); } void MarbleWidget::centerOn( const GeoDataPlacemark& placemark, bool animated ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.centerOn( placemark, animated ); } void MarbleWidget::setCenterLatitude( qreal lat, FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.setCenterLatitude( lat, mode ); } void MarbleWidget::setCenterLongitude( qreal lon, FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.setCenterLongitude( lon, mode ); } @@ -607,21 +619,25 @@ void MarbleWidget::moveLeft( FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.moveByStep( -1, 0, mode ); } void MarbleWidget::moveRight( FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.moveByStep( 1, 0, mode ); } void MarbleWidget::moveUp( FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.moveByStep( 0, -1, mode ); } void MarbleWidget::moveDown( FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.moveByStep( 0, 1, mode ); } @@ -742,6 +758,7 @@ void MarbleWidget::goHome( FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.goHome( mode ); } @@ -1159,6 +1176,7 @@ void MarbleWidget::flyTo( const GeoDataLookAt &newLookAt, FlyToMode mode ) { + d->m_inputhandler->stopInertialEarthRotation(); d->m_presenter.flyTo( newLookAt, mode ); }