Skip to content

Instantly share code, notes, and snippets.

@boucher
Created April 23, 2010 17:38
Show Gist options
  • Save boucher/376864 to your computer and use it in GitHub Desktop.
Save boucher/376864 to your computer and use it in GitHub Desktop.
- (void)mouseDragged:(NSEvent *)anEvent
{
[NSEvent startPeriodicEventsAfterDelay:2.0 withPeriod:0.1];
NSEvent *ev = nil;
BOOL continueTracking = YES;
do
{
ev = [[self window] nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask | NSPeriodicMask];
NSLog(@"PERIODIC EVENT: %@", ev);
switch ([ev type])
{
case NSLeftMouseDragged:
continueTracking = NO;
break;
case NSLeftMouseUp:
continueTracking = NO;
break;
case NSPeriodicMask:
[self autoscroll:anEvent];
break;
}
} while (continueTracking);
[NSEvent stopPeriodicEvents];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment