[Marble-commits] KDE/kdeedu/marble/src/lib

Bastian Holst bastianholst at gmx.de
Sun Jul 11 11:58:27 CEST 2010


SVN commit 1148618 by bholst:

Fixed jump in the rotation of the marble globe when dragging over a pole.

CCBUG: 234861

 M  +19 -18    MarbleWidgetInputHandler.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetInputHandler.cpp #1148617:1148618
@@ -161,6 +161,7 @@
     QCursor m_arrowcur[3][3];
 
     bool m_leftpressed;
+    int m_leftpresseddirection;
     bool m_midpressed;
     int m_leftpressedx;
     int m_leftpressedy;
@@ -505,6 +506,23 @@
                 d->m_leftpresseda = MarbleWidgetInputHandler::d->m_widget->centerLongitude() * DEG2RAD;
                 d->m_leftpressedb = MarbleWidgetInputHandler::d->m_widget->centerLatitude() * DEG2RAD;
 
+                d->m_leftpresseddirection = 1;
+
+                // Choose spin direction by taking into account whether we
+                // drag above or below the visible pole.
+                if ( MarbleWidgetInputHandler::d->m_widget->projection() == Spherical ) {
+                    if ( polarity > 0 ) {
+                        if ( event->y() < ( - MarbleWidgetInputHandler::d->m_widget->northPoleY()
+                                            + MarbleWidgetInputHandler::d->m_widget->height() / 2 ) )
+                            d->m_leftpresseddirection = -1;
+                    }
+                    else {
+                        if ( event->y() > ( + MarbleWidgetInputHandler::d->m_widget->northPoleY()
+                                            + MarbleWidgetInputHandler::d->m_widget->height() / 2 ) )
+                            d->m_leftpresseddirection = -1;
+                    }
+                }
+
                 MarbleWidgetInputHandler::d->m_widget->setViewContext( Animation );
             }
 
@@ -589,26 +607,9 @@
                 if ( abs( deltax ) > d->m_dragThreshold
                      || abs( deltay ) > d->m_dragThreshold ) {
 
-                    qreal direction = 1;
-                    // Choose spin direction by taking into account whether we
-                    // drag above or below the visible pole.
-                    if ( MarbleWidgetInputHandler::d->m_widget->projection() == Spherical ) {
-                        if ( polarity > 0 ) {
-
-                            if ( event->y() < ( - MarbleWidgetInputHandler::d->m_widget->northPoleY()
-                                                + MarbleWidgetInputHandler::d->m_widget->height() / 2 ) )
-                                direction = -1;
-                        }
-                        else {
-                            if ( event->y() > ( + MarbleWidgetInputHandler::d->m_widget->northPoleY()
-                                                + MarbleWidgetInputHandler::d->m_widget->height() / 2 ) )
-                                direction = -1;
-                        }
-                    }
-
                     d->m_lmbTimer.stop();
                     MarbleWidgetInputHandler::d->m_widget->centerOn( RAD2DEG * ( qreal )( d->m_leftpresseda )
-                                                                     - 90.0 * direction * deltax / radius,
+                                                                     - 90.0 * d->m_leftpresseddirection * deltax / radius,
                                                                      RAD2DEG * ( qreal )( d->m_leftpressedb )
                                                                      + 90.0 * deltay / radius );
                 }


More information about the Marble-commits mailing list