NSScrollView two finger drag being interrupted

I have a fairly robust MacOS application that has an NSScrollView that contains a canvas with various subviews (including web views and text views that contain scroll views), and a couple of peer views that track items in the scroll view (eg: screen space controls).

Some of these views interrupt two finger scrolling. Every scroll view, and one of the peer views (essentially a stack view with buttons in it).

I have written an additional bare bones application which does roughly the same thing, and my bare bones application works perfectly: Start two-finger dragging, scroll any of these other things under the cursor, I can continue to drag (and start dragging in any of those, and they drag without interfering with the parent scroll view).

I have tried everything to recreate the interruption, including drag gestures attached to these various ancillary views, and I cannot figure out why dragging some of these views under the cursor interrupts two finger drag in our application, but not in my testbed.

Does anyone have suggestions for how to debug this? I can see that there is a gesture recognizer in the NSScrollView hierarchy, but I don't see it in any of my gesture recognizer handling. I have breakpoints on every variation of hit testing and mouse motion, and none of them are getting hit in unexpected ways.

I'm at my wit's end. Thanks.

Did you ever find a solution to this?

I'm running into an issue where two finger scrolling on a Magic Trackpad can occasionally be interrupted.

In my case the documentView is only scrollable vertically. But there is a situation (intentionally) where some subviews of the document view are positioned outside of the visible region on the x-axis (say extended a bit beyond NSMaxX of the visibleRect or before before NSMinX, not too many views though). We can call this a "row" of subviews.

When the mouse is hovered over this row on the Y-axis (with the views off screen) when vertical scrolling first starts scrolling can be interrupted. I tried all sorts of things like setting clipsToBounds YES on the a bunch parent views and even the document view itself thinking drawing outside the visible area has something to do with this laggy scroll.

This only occurs with two finger drag on a Magic Trackpad (not sure about Magic Mouse because I don't have one) but I have a non-Apple scroll wheel mouse and vertical scrolling never seems to be interrupted.

At first I though my -scrollWheel override did it so I took it out and it but the problem still occurs.

so it looks like if one subview of the document view extends past its NSMaxX(self.bounds) even partially two finger drag scrolling can stutter when scrolling is initiated from around this area of the scroll view.

I don't want to widen the document view because I actually don't want horizontal scrolling in this case

I'm not sure if our issues are exactly the same but in my case when scrolling gets stuck the scroll bar also remains visible like it's paused until I mouse click and the scroll position jumps for all the skipped frames. I dk if they are pausing a private CADisplayLink or something erroneously. Something not nice is going on with NSScrollView here! A subview sticking out partially on a horizontal edge slightly seems to trigger it for me.

So regardless of whether or not I have subviews sticking out on the right or left edge of the scroll view it seems I can achieve "butter vertical scrolling" simply by overriding -scrollWheel: in the 'document view' subclass and moving the scroll point myself without calling super....

-(void)scrollWheel:(NSEvent*)event
{
    CGFloat deltaY = (event.hasPreciseScrollingDeltas) ? event.scrollingDeltaY : event.scrollingDeltaY * self.enclosingScrollView.verticalLineScroll;
    NSRect currentVisibleRect = self.visibleRect;
    CGPoint scrollPoint = currentVisibleRect.origin;
    scrollPoint.y = scrollPoint.y - deltaY;
    [self scrollPoint:scrollPoint];
}

I wish I didn't spend half a day on this!!!!

NSScrollView two finger drag being interrupted
 
 
Q