The little yellow dot -- SystemWindow resizing

Jim Benson jb at speed.net
Mon Jul 16 20:44:32 UTC 2001


Joern ,

> One thing I particularly like is that you don't get that annoying effect
that you click to resize, don't actually move the mouse, release the button,
and the window is resized all the same, because the new bounds are based on
cursor *location*, not *movement*
>

Right, that's one of the side effects of not calculating the cursor offset
from the edge in the older code. You notice it much more dramatically when
you try to resize from a corner, where the window size seems to jump to
match the cursor.

> I would prefer the corner handles to be L-shaped, too, rather than
rectangle-shaped, so you can have a, say, 2-pixel border but have the
"corner" extend 16 pixels along the edges.

There are a couple of ways to attack this. First come up with a complex
shaped morph that indicates the resize region. A PolygonMorph comes to mind,
or some fiddling around with a rectange with an exclusion area.

However, I've noticed that when I start building out window frames, most of
the corner rectangular areas will be occluded by other morphs. Cleverly
placed, outside elements can just cover up the area in question. As an
example, if you look at a regular MS-Windows frame and try to apply it to
our example, you can imagine a title bar morph overlaying the topLeft and
topRight corners of the resizing mechanism, with just a couple of pixels
exposed for resizing. That's what I'm currently doing on my working
prototypes.

In overview, in practice the 'window frame' that you see in the example is
transparent, and provides the interaction mechanism for resizing. Opaque
morphs provide the pure fluff of what the frame actually looks like.
Layering of the morphs determine which morph gets control. Taking the
MS-Windows theme, layer 1 is a morph or a drawn frame border that looks like
the surrounding window frame. In my Squeak 2.8 code, this was just drawn,
rather than an extra morph. The resizing mechanism comes next (it is
transparent). In the third layer, the title bar is layed down, then the
buttons. The title bar occludes most of the upper left and right hand
corners. The pane area comes next, which occludes most of the bottom right
and left corners of the window resize mechanism. If you set the borderWidth
of the WindowFrameTest morph to 4 (from 16) in the initialize statement,
you'll see the configuration that I normally use.

I'll have to think about this a while, I probably need to be able to
describe the resizing areas more extensively, noting that I don't expect all
resizing areas to be rectangular.

> However, in the tradition of tackling the hardest parts first (ahem...), I
have attached a changeset that makes the diagonal cursors roughly the same
size as the horizontal/vertical ones.
>

Nice. One of my projects is to make the cursor match the size of the native
OS cursor, which for MS-Windows is 32x32 so that I won't go blind trying to
locate the cursor on the screen.

> One other tiny problem: if you resize and one dimension reaches its
minimal limit, and you move the cursor further, *off* the bordermorph, the
cursor is not reset to normal when you release the button. Looks like a
"Cursor normal beCursor" in "mouseUp:" (like there already is in
"mouseLeave:") takes care of that.
>

Oh no, a bug already !!! I have my work cut out for me ;-) I also need to
add other constraints, such as support for a maximum extent, and insuring
that the resizing points are on the Display .


> Finally, there should eventually be support for the
fastDragWindowForMorphic preference...

Personally I don't use that preference, but if the lynch mob clamors enough
...

Jim


----------------------------------------------------------------------------
----


> 'From Squeak3.1alpha of 30 April 2001 [latest update: #4173] on 16 July
2001 at 7:34:03 pm'!
>
> !Cursor class methodsFor: 'constants' stamp: 'je 7/16/2001 19:31'!
> originResize
> ^ (Cursor
> extent: 16 at 16
> fromArray: #(
> 2r000000000000000
> 2r000000000000000
> 2r000000000000000
> 2r001111100000000
> 2r001111000000000
> 2r001110000000000
> 2r001101000000000
> 2r001000100000000
> 2r000000010001000
> 2r000000001011000
> 2r000000000111000
> 2r000000001111000
> 2r000000011111000
> 2r000000000000000
> 2r000000000000000
> 2r000000000000000)
> offset: -7 at -7)
> withMask! !
>
> !Cursor class methodsFor: 'constants' stamp: 'je 7/16/2001 19:28'!
> topRightResize
> ^ (Cursor
> extent: 16 at 16
> fromArray: #(
> 2r000000000000000
> 2r000000000000000
> 2r000000000000000
> 2r000000011111000
> 2r000000001111000
> 2r000000000111000
> 2r000000001011000
> 2r000000010001000
> 2r001000100000000
> 2r001101000000000
> 2r001110000000000
> 2r001111000000000
> 2r001111100000000
> 2r000000000000000
> 2r000000000000000
> 2r000000000000000)
> offset: -7 at -7)
> withMask! !
>
>





More information about the Squeak-dev mailing list