• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why isn't scrollRectToVisible animating?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why isn't scrollRectToVisible animating?


  • Subject: Why isn't scrollRectToVisible animating?
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 04 Jul 2013 11:09:20 -0700

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 (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


  • Follow-Ups:
    • Re: Why isn't scrollRectToVisible animating?
      • From: Michael Crawford <email@hidden>
  • Prev by Date: Re: Post to a particular friend or friends group on Facebook
  • Next by Date: Re: Why isn't scrollRectToVisible animating?
  • Previous by thread: Re: Post to a particular friend or friends group on Facebook
  • Next by thread: Re: Why isn't scrollRectToVisible animating?
  • Index(es):
    • Date
    • Thread