]> git.mxchange.org Git - simgear.git/commitdiff
Canvas: trigger missing events on mouseup.
authorThomas Geymayer <tomgey@gmail.com>
Sat, 29 Jun 2013 09:33:40 +0000 (11:33 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Sat, 29 Jun 2013 09:33:44 +0000 (11:33 +0200)
On mouseup send mouseout/mouseleave to old element and
mouseenter/mouseover to new element. This fixes hover
actions after dragging.

simgear/canvas/CanvasEventManager.cxx

index ed4a90c1f91fc9acccd5118bb809fa9edc4c32e4..a10b7c008a527721e42c681b94ff2fac2e53af95 100644 (file)
@@ -78,13 +78,19 @@ namespace canvas
         break;
       case Event::MOUSE_UP:
       {
-        if( _last_mouse_down.path.empty() )
-          // Ignore mouse up without any previous mouse down
-          return false;
+        // If the mouse has moved while a button was down (aka. dragging) we
+        // need to notify the original element that the mouse has left it, and
+        // the new element that it has been entered
+        if( _last_mouse_down.path != path )
+          handleMove(event, path);
 
         // normal mouseup
         propagateEvent(event, path);
 
+        if( _last_mouse_down.path.empty() )
+          // Ignore mouse up without any previous mouse down
+          return false;
+
         // now handle click/dblclick
         if( checkClickDistance(path, _last_mouse_down.path) )
           handleClick(event, getCommonAncestor(_last_mouse_down.path, path));