Re: -[CALayer hitTest:] incorrect when embedding layer-backed NSView subclass inside NSScrollView
Re: -[CALayer hitTest:] incorrect when embedding layer-backed NSView subclass inside NSScrollView
- Subject: Re: -[CALayer hitTest:] incorrect when embedding layer-backed NSView subclass inside NSScrollView
- From: Jim Correia <email@hidden>
- Date: Mon, 4 May 2009 21:28:24 -0400
On Mon, May 4, 2009 at 6:19 PM, Steven Degutis <email@hidden> wrote:
> Specifically, you'll notice that the -hitTest: returns the correct
> layer *only* if you click the view while it is fully visible in the
> window, and before you have made it not-fully-visible for the first
> time. After you resize the scroll view to hide any portion of this
> NSView subclass, -hitTest: will consistently return the wrong layer
> every time.
[...]
> - (void) mouseDown:(NSEvent*)event {
> NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
> CALayer *layer = [self.layer hitTest:NSPointToCGPoint(point)];
> NSLog(@"%@", [layer name]);
> }
>
> I've tried to replace `self` with the enclosing scroll view, or its
> content view or document view, in the -mouseDown: method, and many
> combinations of this. Nothing seems to do the trick.
-hitTest on CALayer, like NSView, takes a point in the superlayer's coordinate
system.
Jim
_______________________________________________
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