Canvas: trigger missing events on mouseup.

On mouseup send mouseout/mouseleave to old element and
mouseenter/mouseover to new element. This fixes hover
actions after dragging.
This commit is contained in:
Thomas Geymayer 2013-06-29 11:33:40 +02:00
parent 5818366d92
commit b0d6ed3844

View 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));