Re: Zooming a view, that is contained in an NSScrollView
Re: Zooming a view, that is contained in an NSScrollView
- Subject: Re: Zooming a view, that is contained in an NSScrollView
- From: John Pannell <email@hidden>
- Date: Mon, 17 Oct 2011 12:59:06 -0600
Hi Nick-
There is some composition of views needed to make this work. Within GCDrawKit, find the GCZoomView class… make your custom view a subview of this (to adopt all of its zoomy goodness). Then, make your custom drawing view the documentView of an NSScrollView.
You'll now need to wire up some controls in the UI (i.e. some menu items or buttons) to call the various zooming methods that your view has now inherited from GCZoomView. Once you're wired up correctly, everything will "just work" - the scroll view will respond to the size changes of your document, and your drawing will now scale up and down per the user's use of the controls you've provided.
It is a really nice bit of code (thanks Graham!)
John
John Pannell
http://www.positivespinmedia.com
On Oct 17, 2011, at 12:46 PM, Nick wrote:
> Hi Fritz,
> thank you for the link.
> My application actually is very simple, and the drawing part is
> implemented already "by hand".
> So I was just wondering whether or not (and how) it is possible to
> implement this zooming using NSScrollView
>
> 2011/10/17 Fritz Anderson <email@hidden>:
>> On 17 Oct 2011, at 11:47 AM, Nick wrote:
>>
>>> I am trying to implement a simple vector graphics editor.
>>> I have some thoughts on how to implement the elements positioning,
>>> storage and select-ability.
>>
>> GCDrawKit <http://apptree.net/drawkit.htm> may help you make (a lot of) progress.
>>
>> — F
>>
>>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden