Skip to content

Instantly share code, notes, and snippets.

@patrick99e99
Created March 27, 2011 17:24
Show Gist options
  • Save patrick99e99/889390 to your computer and use it in GitHub Desktop.
Save patrick99e99/889390 to your computer and use it in GitHub Desktop.
mouseMove: function(event) {
var x = event.pageX,
y = event.pageY;
if (self.isOutsideOfIcon(x, y) && self.isOutsideOfMenu(x, y)) {
// mouse has left bounds.. do something here..
}
},
isOutsideOfMenu: function(x, y) {
return !self.isWithinXBounds(menu_obj.bounds, x) || !self.isWithinYBounds(menu_obj.bounds, y);
},
isOutsideOfIcon: function(x, y) {
return !self.isWithinXBounds(icon_obj.bounds, x) || !self.isWithinYBounds(icon_obj.bounds, y);
},
isWithinXBounds: function(element_bounds, x) {
return x >= element_bounds.left && x <= element_bounds.right;
},
isWithinYBounds: function(element_bounds, y) {
return y >= element_bounds.top && y <= element_bounds.bottom;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment