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

List:       kde-commits
Subject:    KDE/kdegames/kpat
From:       Parker Coates <parker.coates () gmail ! com>
Date:       2009-05-25 17:04:47
Message-ID: 1243271087.338860.24874.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 972781 by coates:

Fixed a bug where it was possible for the cursor to leave the bounds of the card \
being dragged if the mouseMoveEvent is particularly laggy.

This issue came up because, for some reason, the first mouse move event generated \
after KPat starts is significantly slower than any other.

 M  +10 -5     dealer.cpp  


--- trunk/KDE/kdegames/kpat/dealer.cpp #972780:972781
@@ -760,12 +760,17 @@
         return;
 
     if (!moved) {
-        const QPointF delta = e->scenePos() - moving_start;
-        const qreal distanceSquared = delta.x() * delta.x() + delta.y() * delta.y();
-        // Ignore the move event until we've moved at least 4 pixels
-        if (distanceSquared > 16.0) {
+        bool overCard = \
movingCards.first()->sceneBoundingRect().contains(e->scenePos()); +        QPointF \
delta = e->scenePos() - moving_start; +        qreal distanceSquared = delta.x() * \
delta.x() + delta.y() * delta.y(); +        // Ignore the move event until we've \
moved at least 4 pixels or the +        // cursor leaves the card.
+        if (distanceSquared > 16.0 || !overCard) {
             moved = true;
-            moving_start = e->scenePos();
+            // If the cursor hasn't left the card, then continue the drag from
+            // the current position, which makes it look smoother.
+            if (overCard)
+                moving_start = e->scenePos();
         }
     }
 


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

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