Get image location of a mouse click
Get image location of a mouse click
- Subject: Get image location of a mouse click
- From: Robert Palmer Jr <email@hidden>
- Date: Sat, 14 Sep 2002 11:38:33 -0400
Sorry for the repost - I'm rewording the question - I really need to
figure out a solution to this.
I have a class that subclasses NSImageView. I have the NSImageView
configured to scale the image proportionally. I want to be able to
click on the scaled image view and determine where in the original
image that click occurred. This means I need to translate the
MouseEvent's coordinates into accurate coordinates in the original
image coordinate space.
The question is, how do I determine the current scaling factor at
which an NSImage is being drawn in an NSImageView?
Here's the basic process (I know the function names aren't correct - I
don't have my code in front of me and don't remember the exact names) I
have the first two steps working fine, just need the last step:
Assume I have a 1024x1024 image being displayed proportionally in a
640x480 view (which means it will actually be displayed at 480x480).
mouseClick --> get coordinates in window space
convertToViewCoor --> get coordinates of click in view space (in
640x480 range)
WHAT_GOES_HERE --> get cooridnates of click in original image space (in
1024x1024 range)
Robert Palmer, Jr
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.