Re: NSImageView and ZoomFactors
Re: NSImageView and ZoomFactors
- Subject: Re: NSImageView and ZoomFactors
- From: Brian Postow <email@hidden>
- Date: Fri, 20 Aug 2010 09:46:58 -0400
On Aug 19, 2010, at 7:54 PM, Quincey Morris wrote:
> On Aug 19, 2010, at 12:44, Brian Postow wrote:
>
>> ah, so, the way to zoom is to leave the NSImageView on NSImageScaleProportionallyUpOrDown, and then change the size of the frame! That gives me scrollbars!
>
> I had to go out for a while before finishing my last post, but I wanted to point out that you likely *don't* want to be using NSImageView at all for this. The problem is that you seem to want to be doing additional drawing (you mentioned selection rectangles) earlier, but consider that you almost certainly don't want such drawing to be scaled along with the image. There are 3 ways to deal with this:
>
If I don't want to be using NSImageView, what DO I want to be using? I started out trying to use IKImageView, but that is swatting a fly with a bazooka. It takes like 2 seconds to draw the image because its doing lots of thumbnailing and stuff that I don't need... is there another kind of imageview I should use?
>
>> I think I now need to add some translation when I zoom so that my image doesn't migrate off the upper right of the screen... Is that the standard way of doing that?
>
> The position of the document view relative to the clip view is determined by the relationship of the document view frame to the bounds origin of the content view. (Keep in mind that both are in the same coordinate system.) The easiest way is to set the document view frame origin with a suitable offset. (The amount of the offset is usually easy to calculate. I always figure out the sign -- direction -- of the offset by trial and error, but I always get it exactly wrong when trying to figure it out in advance.)
Ok,. Since the NSImageView wants to always center the image in the bounds rect, that should make the translation (moving the origin) not too hard, yes?
Brian Postow
Senior Software Engineer
Acordex Imaging Systems
_______________________________________________
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