• 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
Re: -[CALayer hitTest:] incorrect when embedding layer-backed NSView subclass inside NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >-[CALayer hitTest:] incorrect when embedding layer-backed NSView subclass inside NSScrollView (From: Steven Degutis <email@hidden>)

  • Prev by Date: OT: WWDC Rooms available
  • Next by Date: A couple NSRunLoop questions
  • Previous by thread: -[CALayer hitTest:] incorrect when embedding layer-backed NSView subclass inside NSScrollView
  • Next by thread: Newbie question about non-document-based app
  • Index(es):
    • Date
    • Thread