On 02/09/2009, at 2:30 PM, Matthias Arndt wrote:

It was my understanding that a custom view could be zoomed in (at least) two ways:

(1.) using "scaleUnitSquareToSize" of the clip view (leaving the coordination system of the custom view untouched) or

(2.) changing the bounds / frame of the custom view and handling the scaling in the custom view's drawRect:

As the first one worked (under Mac OS 10.5) and was less intrusive to my code, I never tried the second one. To be honest I can't remember why I used "scaleUnitSquareToSize" of the clip and not the custom view. I'll definitely give it a try the next days ...

Hi Matthias,

If it's any help, I have a free general purpose view class that handles zooming. It uses -scaleUnitSquareToSize internally, and provides some high level action methods for adding zoom commands to your app. The main thing to note is that -drawRect "just works" - you do not have to know the current scale factor to draw things (unless you need to explicitly compensate for the zoom, for example when drawing selection handles, etc), which is as it should be. It has worked fine from 10.2 to 10.6 with no changes.

Another thing to be aware of is that if you do it right, the ruler views managed by the scrollview also "just work" and allow for the view's zoom. I don't think you should be doing what you're doing to the NSClipView.

http://apptree.net/gczoomview.htm

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to