From 2a8cb43d020f0422bc00b294bcff088ee49fb3cd Mon Sep 17 00:00:00 2001 From: Ben Delarre Date: Fri, 12 Sep 2014 16:01:19 -0700 Subject: [PATCH] Fixes issue #464 by adding mouseout handler to document and calling mouseUp handler --- src/mousetracker.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mousetracker.js b/src/mousetracker.js index 7a4df604..60500660 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -192,6 +192,8 @@ mouseupcaptured: function ( event ) { onMouseUpCaptured( _this, event ); }, mousemove: function ( event ) { onMouseMove( _this, event ); }, mousemovecaptured: function ( event ) { onMouseMoveCaptured( _this, event ); }, + + mouseoutdocument: function ( event ) { onMouseUp( _this, event ); }, touchenter: function ( event ) { onTouchEnter( _this, event ); }, touchleave: function ( event ) { onTouchLeave( _this, event ); }, @@ -1049,6 +1051,10 @@ false ); } + + // handle mouse out of document area + $.addEvent(document, "mouseout", delegate['mouseoutdocument']); + delegate.tracking = true; } } @@ -1074,6 +1080,9 @@ ); } + // handle mouse out of document area + $.removeEvent(document, "mouseout", delegate['mouseoutdocument']); + delegate.tracking = false; } }