• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Zooming a view, that is contained in an NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Zooming a view, that is contained in an NSScrollView


  • Subject: Re: Zooming a view, that is contained in an NSScrollView
  • From: Nick <email@hidden>
  • Date: Wed, 19 Oct 2011 18:16:25 +0300

Thanks a lot Graham and John!
That did it :-)


2011/10/18 Graham Cox <email@hidden>:
>
> On 18/10/2011, at 5:59 AM, John Pannell wrote:
>
>> 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!)
>
>
> Thanks ; you're welcome :)
>
> GCZoomView is independent of DrawKit, and can be downloaded and deployed separately:  http://apptree.net/gczoomview.htm
>
> There may be small differences between this and the version you get in DK however - DK's copy is possibly slightly more up to date.
>
>
>> The problem is i don't know how would it be right to implement Zooming
>> (similar to how graphics editors do it - by allowing the user to
>> select some area of the view with a selection rectangle, and, after
>> the mouseUp event happens, zoom in or out the view that is contained
>> within an NSScrollView.
>
> GCZoomView will help you do this, but it doesn't implement the mouse dragging part, you'll have to do that yourself in order to define the rectangle, then you can use [GCZoomView zoomViewToRect:] to adjust the zoom scale and scroll to that rectangle. The zooming does not change the coordinate system of the view itself, the view content is not aware of the zoom unless you deliberately code it to be so.
>
> --Graham
_______________________________________________

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

References: 
 >Zooming a view, that is contained in an NSScrollView (From: Nick <email@hidden>)
 >Re: Zooming a view, that is contained in an NSScrollView (From: Fritz Anderson <email@hidden>)
 >Re: Zooming a view, that is contained in an NSScrollView (From: Nick <email@hidden>)
 >Re: Zooming a view, that is contained in an NSScrollView (From: John Pannell <email@hidden>)
 >Re: Zooming a view, that is contained in an NSScrollView (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: ARC + return of autoreleased CFType
  • Next by Date: Re: ARC + return of autoreleased CFType
  • Previous by thread: Re: Zooming a view, that is contained in an NSScrollView
  • Next by thread: OutlineView Expand Animation
  • Index(es):
    • Date
    • Thread