[Cuis-dev] Layout edgeWeight: how do you like this explanation?

Dan Norton dnorton at mindspring.com
Wed Apr 29 14:07:17 PDT 2020


Hi Ken,

Your draft inspires some wondering aloud :)

On Tue, 28 Apr 2020 21:45:34 +0000
"ken.dickey--- via Cuis-dev" <cuis-dev at lists.cuis.st> wrote:

> ===============================================
>   Proposed brief discussion in the Terse Guide:
> ===============================================
> 
> LayoutMorph's arrange subMorphs as either a horizontal Row or a
> vertical Column.

A LayoutMorph arranges its submorphs in either a row or a column and is
created by either:

x := LayoutMorph newRow. 
or
x := LayoutMorph newColumn.

> 
> Along this Major or Layout Axis, subMorphs may be attracted toward
> one side (0.0) or the other (1.0).  This is the LayoutMorph's 
> axisEdgeWeight.

(Would it be worthwhile to not reveal the #(0.0 0.5 1.0) values which
Morphic uses internally?)

Submorphs can have an optional specification (LayoutSpec) which causes
them to be attracted to the left, center, or right of a row; or, the
top, center, or bottom of a column. This is specified by the parameters:

#rowLeft, #center, rowRight
#columnTop, #center. #columnBottom

(What happens if a column LayoutMorph encounters #rowLeft, for
example? Should the symbols be #leftOrTop, #center, #rightOrBottom,
giving us three instead of six?)

Note that a LayoutSpec is effective only in a submorph of a
LayoutMorph. It is ignored by other morphs.

> 
> If a Row, one can specify this weight symbolically as
>    { #rowLeft (0.0), #center (0.5), #rowRight (1.0)}
> 
> If a Column, one can specify the weight symbolically as:
>    { #columnTop (0.0), #center (0.5), #columnBottom (1.0) }
> 
> A LayoutMorph may also have a Morph Separation specified: x at y

(Is this sent to the LayoutMorph or the LayoutSpec?)

This concludes my hallucinations (for now).

 - Dan

> 
> ======
> 
> Each subMorph of a LayoutMorph may have an optional LayoutSpec which
> the subMorph uses to indicate how it wants to be arranged.
> 
> Options include treating Morph's width and height as fixed or 
> proportional to the LayoutMorph's extent.
> 
> A LayoutSpec may also indicate a weighting perpendicular to the
> Layout Axis.   This is the LayoutSpec's offAxisEdgeWeight.
> 
> Again, symbols may be used.
> 
> If in a Row: { #rowTop (0.0), #center (0.5), #rowBottom (1.0)}
> 
> If in a Column: { #columnLeft (0.0), #center (0.5), #columnRight
> (1.0) }
> 
> ========================================================================



More information about the Cuis-dev mailing list