• 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: NSRulerView and inches
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSRulerView and inches


  • Subject: Re: NSRulerView and inches
  • From: Graham Cox <email@hidden>
  • Date: Fri, 22 Jan 2010 11:26:42 +1100

On 22/01/2010, at 7:00 AM, Quincey Morris wrote:

>  In your data model, keep your sizes and locations in whatever units make the most sense, then expect to *transform* the values to view units (which depend, at least, on the view's zoom factor). In general, it's awkward to let the view do the scaling automatically (by manipulating the relationship between its bounds and its frame), because you often want to draw your view contents scaled in both size and location, but your UI widgetry (such as selection handles) using unscaled sizes on scaled locations.


Note that rulers automatically deal with the view's zoom so you don't normally have to factor that in manually.

I'd say that letting the view do the scaling is definitely the easiest way to do it, through its -scaleUnitSquareToSize: method. It's true that elements such as selection handles and whatnot probably need to compensate for the view scale in the opposite direction, but it's probably better to apply that "unzooming" to the selection handles when they are drawn as a special case rather than the general scalable content. I also found that cancelling out the zoom altogether for handles is less usable than allowing them to scale in some proportion to the main zoom, e.g. at about 1/3rd the rate. That keeps them small enough not to block out the things they are associated with but still large enough to see and hit when zoomed in.

A simple zoomable view class that I've used in a few projects now is here:

http://apptree.net/gczoomview.htm

--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

  • Follow-Ups:
    • Re: NSRulerView and inches
      • From: Quincey Morris <email@hidden>
    • Re: NSRulerView and inches
      • From: Kyle Sluder <email@hidden>
References: 
 >NSRulerView and inches (From: Milen Dzhumerov <email@hidden>)
 >Re: NSRulerView and inches (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: [iPhone] Adding a UIView to current view
  • Next by Date: Re: Accepting and Responding to Keystrokes
  • Previous by thread: Re: NSRulerView and inches
  • Next by thread: Re: NSRulerView and inches
  • Index(es):
    • Date
    • Thread