Most of the time NSScrollView’s animated scrolling Just Works. But I’m running into a frustrating edge case where the exact same scroll code animates in response to one UI event but not another.
Here’s the deal: In my app the left and right arrow keys jump to the previous/next track marker in an audio timeline view. To do this I compute the NSRect of the marker in the view and then call -scrollRectToVisible: to scroll that into view. Works great, and the scrolling is animated, which is what I want. Now I want the 3-finger “swipe” gesture do the same thing. So I implemented -swipeWithEvent: to check the dx and dy of the event and then call exactly the same code that the arrow-keys call. It scrolls correctly … but it doesn’t animate. It just jumps. Any idea what’s going on here? I suspect NSScrollView has a bunch of complicated heuristics about when it will animate and when not, and I’m running afoul of those somehow. But I don’t see why — I’m basically just doing: - (void)swipeWithEvent:(NSEvent *)event { if (event.deltaY == 0) { [self moveSelectionBy: event.deltaX]; [self scrollRectToVisible: [self rectForSelection]]; } } —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com