Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zooming in an NSView

I have an NSView in which the user can draw circles. These circles are stored as an array of NSBezierPaths, and in drawRect:, I loop through the array and call -stroke on each of the paths. How do I add a button to zoom in and out the NSView? Just change the bounds of the view?

Thanks.

like image 571
jasonbogd Avatar asked Mar 15 '10 01:03

jasonbogd


2 Answers

Send your view a scaleUnitSquareToSize: message.

like image 186
Peter Hosey Avatar answered Nov 03 '22 01:11

Peter Hosey


You might also find this informative:

https://developer.apple.com/library/content/qa/qa1346/_index.html

The code in that document lets you add a "scale" property to a view.

like image 26
NSResponder Avatar answered Nov 03 '22 00:11

NSResponder