[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.5/kdeedu/marble/src/lib
From:       Bastian Holst <bastianholst () gmx ! de>
Date:       2010-07-11 10:21:20
Message-ID: 20100711102120.77116AC85F () svn ! kde ! org
[Download RAW message or body]

SVN commit 1148628 by bholst:

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

CCBUG: 234861

backport of r1148618

 M  +19 -18    MarbleWidgetInputHandler.cpp  


--- branches/KDE/4.5/kdeedu/marble/src/lib/MarbleWidgetInputHandler.cpp \
#1148627:1148628 @@ -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 );  }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic