NSScrollView, NSCollectionView and "zooming" / resizing to the center
NSScrollView, NSCollectionView and "zooming" / resizing to the center
- Subject: NSScrollView, NSCollectionView and "zooming" / resizing to the center
- From: Daniel Vollmer <email@hidden>
- Date: Wed, 21 May 2008 00:22:22 +0200
Hi all,
the subject is vague, but I'm at a loss for how to describe my
problem. I have an NSCollectionView inside an NSScrollView (as is
usual). I display a bunch of items (in 1 column and multiple rows) in
the collection view. The (custom views) inside the collection view are
set to resize to take up all available space.
I perform a "zoom" for the items in the collection view by setting its
minimum item width to twice its frame width. This correctly enlarges
the collection view (and makes the scroll view come into action —
although it is bugged if it is set to autohide scrollers), but leaves
the origin of the visible rect of the collection view as it is.
Now, instead of the left hand side of the collection view's items
staying at the same position, I would like the *center* to stay the
same, but I'm not sure what and where to override to achieve that.
Doing some explicit scrolling (scrollToPoint) right after increasing
the minimum item size doesn't seem to work.
Let's try some ASCII art. This is a row of my collection view
displaying a view, with the square brackets [] indicating the
visibleRect
[1234]
If I double the view's width by increasing the collection view's
minItemSize to 2 * its width, I get
[1122]3344, i.e. the right-hand side of the view is now outside of the
visible rect and the left-hand side stays fixed at the origin.
As I said, for what I'd *like* to happen is for [1234] to turn into
11[2233]44, i.e. for the center to stay the same.
Any ideas?
Thanks,
Daniel.
_______________________________________________
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