- (BOOL)wantsScrollEventsForSwipeTrackingOnAxis:(NSEventGestureAxis)axis
{
// Inform the underlying view that we want horizontal scroll gesture events
return (axis == NSEventGestureAxisHorizontal) ? YES : NO;
}
// Use horizontal swipe events to mean 'back' and 'forward', like a browser back button
- (void)scrollWheel:(NSEvent *)event
{
[event trackSwipeEventWithOptions:0 dampenAmountThresholdMin:-1 max:1 usingHandler:^(CGFloat gestureAmount, NSEventPhase phase, BOOL isComplete, BOOL *stop) {
//NSLog(@"Got swipe amount %f phase %lu complete %d", gestureAmount, phase, isComplete);
//if (isComplete)
if (phase == NSEventPhaseBegan)
{
if (gestureAmount > 0)
{
// Simulate a 'back' operation
[mandel_controller backButton:self];
}
else
{
// Simulate a 'forward' operation
[mandel_controller forwardButton:self];
}
}
*stop = NO;
}];
}