TRectangle>>extent: too clever?

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

TRectangle>>extent: too clever?

Howard Stearns
When a TRectangle has aspectFixed, #extent: will, of course, maintain  
the rectangle's old aspect ratio rather than the one specified.

But the way that it does this is to dynamically choose whether to use  
the width or height asked for (adjusting the other), based on  
whichever one is bigger. This is cute, but it results in some odd  
behavior for TWindow:
     Suppose the rectFront is tall and narrow, and the contents are  
short and wide. Repeated openings and closings make the window shrink  
away to nothing.

I'm having good results by just always using the specified width, but  
I certainly can't claim that this is the one-true Right Answer(TM).

What to do?

I feel that when in doubt, make the choice explicit:  
#extentHoldingX:, #extentHoldingY:, and extentHoldingLarger:.  
TWindow>>openContents/closeContents would use, say #extentHoldingX:.

Other issues?