Skip to content

Instantly share code, notes, and snippets.

@cappuccino
Created June 13, 2009 19:43
Show Gist options
  • Save cappuccino/129404 to your computer and use it in GitHub Desktop.
Save cappuccino/129404 to your computer and use it in GitHub Desktop.
if (!_acceptsMouseMovedEvents)
return;
var hitTestView = [_windowView hitTest:point];
if ([_mouseEnteredStack lastObject] === hitTestView)
return;
var view = hitTestView,
mouseEnteredStack = [];
while (view)
{
mouseEnteredStack.push(view);
view = [view superview];
}
var deviation = MIN(_mouseEnteredStack.length, mouseEnteredStack.length);
while (deviation--)
if (_mouseEnteredStack[deviation] !== mouseEnteredStack[deviation])
break;
var index = deviation,
count = _mouseEnteredStack.length;
if (index < count)
{
var event = [CPEvent mouseEventWithType:CPMouseExited location:point
modifierFlags:[anEvent modifierFlags] timestamp:[anEvent timestamp] windowNumber:_windowNumber context:nil eventNumber:-1 clickCount:1 pressure:0];
for (; index < count; ++index)
[_mouseEnteredStack[index] mouseExited:event];
}
index = deviation;
count = mouseEnteredStack.length;
if (index < count)
{
var event = [CPEvent mouseEventWithType:CPMouseEntered location:point
modifierFlags:[anEvent modifierFlags] timestamp:[anEvent timestamp] windowNumber:_windowNumber context:nil eventNumber:-1 clickCount:1 pressure:0];
for (; index < count; ++index)
[mouseEnteredStack[index] mouseExited:event];
}
_mouseEnteredStack = mouseEnteredStack;
[hitTestView mouseMoved:anEvent];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment