how to correctly implement intertial scrolling using -scrollWheel: ?
how to correctly implement intertial scrolling using -scrollWheel: ?
- Subject: how to correctly implement intertial scrolling using -scrollWheel: ?
- From: Nicolas Ojeda Bar <email@hidden>
- Date: Thu, 14 Jul 2016 07:59:48 +0200
Hi list,
I am implementing a custom NSView which displays pdf files and the
like. I am not/can not use
NSScrollView.
I would like to implement intertial scrolling (when using trackpad)
like in Preview or Safari.
So far I am receiving scrollWheel events on the NSView and doing something like:
- (void)scrollWheel:(NSEvent *)event
{
CGFloat deltaY = -[event scrollingDeltaY];
if ([event hasPreciseScrollingDeltas]) {
if (fabs (deltaY) > 0) {
[connector scrollBy:deltaY]; // performs scrolling of deltaY points
}
}
This works to a first approximation. However the intertial scrolling
seems to be quite "laggy" when
2-finger swiping at *slow* speeds. Also, when changing direction of
scrolling/swiping quickly the
scrolling in one direction continues for a bit before changing direction.
In Preview when one changes the direction of scrolling this occurs
immediately without any lag.
Does anybody have any ideas of where I should be looking to fix this ?
Any suggestion appreciated.
Thanks!
Cheers,
Nicolas
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden