Re: NSImageView and ZoomFactors
Re: NSImageView and ZoomFactors
- Subject: Re: NSImageView and ZoomFactors
- From: Brian Postow <email@hidden>
- Date: Fri, 20 Aug 2010 15:13:32 -0400
On Aug 20, 2010, at 2:52 PM, Quincey Morris wrote:
> On Aug 20, 2010, at 10:54, Brian Postow wrote:
>
>> I just discovered [imageView setImageAlignment: ] which, as long as the imageView is bigger than the scrollview, does the correct thing (Lock the image to the upper left corner of the scrollView). However, when the imageView is smaller than the scrollview, The imageView is still locked to the bottom left of the scrollview, but the image is locked to the top left of the imageview.
>
> The image view's image alignment is irrelevant to scrolling. Scrolling relates entirely and exclusively to the geometric relationship between the document view and the content view. (You say "scrollview", but I think you really mean the content view.) Moving the image around within the image view does something that looks a little bit like scrolling, but isn't -- the scroll bars wouldn't match the part of the image you can see.
>
> If the image view is smaller than the content view, another can of worms gets opened up. It should be possible to put the image view in the center of the content view, or at its top left, which should mean it's surrounded by the scroll view's background color. But then you can't do any drawing outside of the image view, which kind of feels wrong when you're trying to drag out a selection rectangle. So in fact what I usually do is keep the document view at least as large as the content view, even if its "canvas" is a smaller area within it. That effectively divorces both the scale and the position of the image area from the view, something that NSImageView can't actually do.
So, just to clarify, the whole hierarchy is Window> ContentView > ScrollView > ClipView > ImageView > Image? I take the "ContentView" to mean the content view of the window, or is there some other view between the scrollview and the clipview?
If I don't make the imageview smaller than the others (which are (almost) all the same size), then how do I make the image smaller than the content view?
>
>> Setting the Scrollview boundsOrigin, the imageView bounds origin and translating the origin of the imageview or the scrollview had absolutely no effect.
>
> It's not the scroll view that's relevant, but the content (clip) view. I think setting the clip view bounds origin works, or scrollToPoint:, but [imageView setFrame:] is probably the easiest way.
>
Ok, I'll play with the imageView setframe a little more and see if I can get that to work for me.
> I feel like I keep confusing matters rather than clarifying them, so I apologize for that, but I also think the trouble you're having comes from clinging to NSImageView. If you'd let go of that, I suspect things will fall into place fairly easily.
>
But then I have to manually draw my image into the view and keep track of that myself.... I *DO* have an image (NSImage, CGImageRef, bitmap, SOMETHING)
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