Re: keeping a view at a given aspect ratio?
Re: keeping a view at a given aspect ratio?
- Subject: Re: keeping a view at a given aspect ratio?
- From: Vince DeMarco <email@hidden>
- Date: Sun, 2 Jun 2002 17:32:35 -0700
On Saturday, June 1, 2002, at 05:44 PM, Michael B. Johnson wrote:
So I've got an NSMovieView and I want to make sure that it never gets
resized at a different aspect ratio than the movie that it's showing.
What's the best way to accomplish this? I'm thinking of both the obvious
this-is-the-only-view-in-a-resizable-window case as well as one where the
view is one of many on a panel.
I can think of doing things with delegates and constraining the window's
size in the first case, but the second one isn't obvious (at least to me)
as to how to proceed.
Certainly other people must have faced this? I deal with this in my own
stuff where I draw images in a view by just drawing the image at the
correct aspect ratio in the view, regardless of the view's size (and have
black bars on top or bottom, say), but since NSMovieView is controlling
the display of the image, I'm at a loss...
Sure seems a flag one should be able to set in NSMovieView, but I don't
see anything in the header (hmm, maybe I'll file a sug...).
There is a - (NSSize)aspectRatio;
method on NSWindow to constrain the entire window to a particular
aspectRatio.
You could over ride setFrame: on your view subclass and constrain it there.
When the window resizes it will end up calling setFrame: to adjust
everything.
I don't know if this is the best way but it should work.
vince
--> Michael B. Johnson, Ph.D. -- email@hidden
--> Studio Tools, Pixar Animation Studios
--> http://xenia.media.mit.edu/~wave
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.