Re: Obtaining the NSGraphicsContext for custom NSView
Re: Obtaining the NSGraphicsContext for custom NSView
- Subject: Re: Obtaining the NSGraphicsContext for custom NSView
- From: Chris Eplett <email@hidden>
- Date: Mon, 14 Mar 2005 09:50:54 -0500
the locationInWindow of the NSEvent sent to mouseDown is always in the
windows coordinate system. To convert to your view's local coordinates,
do this in your view's mouseDown method:
- (void)mouseDown:(NSEvent*)event
{
NSPoint localPoint = [self convertPoint:[event locationInWindow]
fromView:nil];
}
the "nil" fromView indicates that the coordinates should be converted
from the window's coord system.
Hope this helps!
-
Chris Eplett
palmOne, Inc.
Senior Software Engineer
email@hidden
On Mar 14, 2005, at 9:42 AM, Damien Sorresso wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message
I've got a custom NSView inside a window that acts as first responder
for mouse clicks. I've got it set up right now so that whenever the
user clicks inside the view, an image is drawn at the mouse
coordinates by calling a method. The image draws, but relative to the
containing window, not the view. So it's using the window's coordinate
system.
How can I obtain the view's coordinate system explicitly?
--
Damien Sorresso
Macintosh Developer
Computer Infrastructure Support Services
Illinois State University
email@hidden
309.438.5777
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCNaK4M4NYyqeoGX8RAmzeAJ9JyJZ5yi2rqqBdMSYyBr6Q+AGD/ACgnNLT
g7OBoxtFP3+Dx/T7U4NPcfg=
=LTdu
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden