GUAC-842: Add onmouseout event to Guacamole.Mouse. Fix GUAC-833 while we're in here.

This commit is contained in:
Michael Jumper
2014-10-16 23:15:12 -07:00
parent 8f903acaa6
commit d339c8613e

View File

@@ -100,6 +100,14 @@ Guacamole.Mouse = function(element) {
*/
this.onmousemove = null;
/**
* Fired whenever the mouse leaves the boundaries of the element associated
* with this Guacamole.Mouse.
*
* @event
*/
this.onmouseout = null;
/**
* Counter of mouse events to ignore. This decremented by mousemove, and
* while non-zero, mouse events will have no effect.
@@ -199,7 +207,7 @@ Guacamole.Mouse = function(element) {
// Check that mouseout is due to actually LEAVING the element
var target = e.relatedTarget || e.toElement;
while (target !== null) {
while (target) {
if (target === element)
return;
target = target.parentNode;
@@ -220,6 +228,10 @@ Guacamole.Mouse = function(element) {
guac_mouse.onmouseup(guac_mouse.currentState);
}
// Fire onmouseout event
if (guac_mouse.onmouseout)
guac_mouse.onmouseout();
}, false);
// Override selection on mouse event element.