tags:

views:

150

answers:

0

I have an app that scales images to fit inside my implementation of NSImageView. It uses the NSImage drawRect call to write the image into the space which can resize to whatever the user wants. This works fine but I also need to implement a zoom in feature that will zoom in centered on the spot that the user clicks on in the scaled image. My question then is what is the easiest way to create a transformation for the coordinates so that I can transform where the user clicks in the NSView to the coordinates of the original image so I can crop and zoom in using drawRect again. My intuition says to just create a transformation between the current bounds of the view and the size of the image but it seems like there should be an easier way to do this. If someone could either point me in the direction of something in the API or a better suggestion I would appreciate it. Thanks in advance.