Re: Why isn't scrollRectToVisible animating?
Re: Why isn't scrollRectToVisible animating?
- Subject: Re: Why isn't scrollRectToVisible animating?
- From: Michael Crawford <email@hidden>
- Date: Thu, 04 Jul 2013 20:16:56 +0000
Are you sure that your swipeWithEvent method is actually getting called?
Maybe Cocoa is handling the scrolling itself, because it automagically
recognizes the swipe gesture.
Also check the ensure that you're actually detecting a three-fingered
gesture. I did not use gesture recognizers in Warp Life for iOS, I
rolled my own, mainly because I wanted to understand better how the
gestures worked.
I found that the detection of touches was "bouncy", just like a
mechanical button. I detect one and two finger gestures, but when the
user does a two-finger gesture, my App gets a random series of one and
two finger events, with the one finger events randomly distributed
among the two fingers. I had to figure out how to "debounce" the
events, which I expect the gesture recognizers do as well.
I had in mind at first to support up to five finger gestures, which
iOS devices do support, but I figured that the detection of them would
be increasingly unreliable as the number of fingers increased.
Mike
email@hidden
Available for Mobile Development in Portland, Oregon.
On Thu, Jul 4, 2013 at 6:09 PM, Jens Alfke <email@hidden> wrote:
> 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
--
Michael David Crawford
mdcrawford at gmail dot com
Custom Software Development for the iPhone and Mac OS X
http://www.dulcineatech.com/custom-software-development/
_______________________________________________
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