Issue with NSView setFrame
Issue with NSView setFrame
- Subject: Issue with NSView setFrame
- From: PCWiz <email@hidden>
- Date: Mon, 12 Oct 2009 14:42:15 -0600
I have an NSCollectionView full of NSViews containing NSImageViews.
Basically looks like a NSMatrix of NSImageCells. I've subclassed the
NSCollectionView's prototype NSView and added methods to add a
"magnification" sort of effect when a user hovers on an item:
- (void)mouseEntered:(NSEvent *)theEvent
{
[[self animator] setFrame:NSMakeRect([self frame].origin.x, [self
frame].origin.y, [self frame].size.width * 1.3, [self
frame].size.height * 1.3)];
}
- (void)mouseExited:(NSEvent *)theEvent
{
[[self animator] setFrame:NSMakeRect([self frame].origin.x, [self
frame].origin.y, [self frame].size.width / 1.3, [self
frame].size.height / 1.3)];
}
This works for the most part, if I hover over the items slowly. As
soon as I start zipping my mouse around fast, the views become all
disoriented. Here's a video I took of the problem:
http://twitvid.com/6426F
I'm not sure what I'm doing wrong here. Also, how do I make it so that
the frame size increases from the center of the view outwards. Like
right now it looks like its magnifying from the left to the right. I'm
sure theres something I need to do with the origin, but I'm not sure.
Thanks
_______________________________________________
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