ui.gadgets.packs: cleanup
parent
a0aabffb31
commit
a41e502bad
|
@ -23,7 +23,7 @@ HELP: pack
|
||||||
}
|
}
|
||||||
"Packs have the following slots:"
|
"Packs have the following slots:"
|
||||||
{ $list
|
{ $list
|
||||||
{ { $snippet "align" } " a rational number between 0 and 1, the alignment of gadgets along the axis perpendicular to the pack's orientation" }
|
{ { $snippet "align" } " a rational number between 0 and 1, or " { $link +baseline+ } "; the alignment of gadgets along the axis perpendicular to the pack's orientation" }
|
||||||
{ { $snippet "fill" } " a rational number between 0 and 1, where 0 gives each gadget its preferred size and 1 fills the dimension perpendicular to the pack's orientation" }
|
{ { $snippet "fill" } " a rational number between 0 and 1, where 0 gives each gadget its preferred size and 1 fills the dimension perpendicular to the pack's orientation" }
|
||||||
{ { $snippet "gap" } " a pair of integers, the horizontal and vertical gap between children" }
|
{ { $snippet "gap" } " a pair of integers, the horizontal and vertical gap between children" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,15 +61,18 @@ PRIVATE>
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: gap-dims ( pack sizes -- seeq )
|
: gap-dim ( pack -- dim )
|
||||||
[ gap>> ] [ [ length 1 [-] ] [ dim-sum ] bi ] bi* [ v*n ] dip v+ ;
|
[ gap>> ] [ children>> length 1 [-] ] bi v*n ;
|
||||||
|
|
||||||
: max-pack-dim ( pack sizes -- dim )
|
: max-pack-dim ( pack sizes -- dim )
|
||||||
over align>> +baseline+ eq?
|
over align>> +baseline+ eq?
|
||||||
[ [ children>> ] dip baseline-metrics + 0 swap 2array ] [ nip max-dim ] if ;
|
[ [ children>> ] dip baseline-metrics + 0 swap 2array ] [ nip max-dim ] if ;
|
||||||
|
|
||||||
: pack-pref-dim ( pack sizes -- dim )
|
: pack-pref-dim ( pack sizes -- dim )
|
||||||
[ max-pack-dim ] [ gap-dims ] [ drop orientation>> ] 2tri set-axis ;
|
[ max-pack-dim ]
|
||||||
|
[ [ gap-dim ] [ dim-sum ] bi* v+ ]
|
||||||
|
[ drop orientation>> ]
|
||||||
|
2tri set-axis ;
|
||||||
|
|
||||||
M: pack pref-dim*
|
M: pack pref-dim*
|
||||||
dup children>> pref-dims pack-pref-dim ;
|
dup children>> pref-dims pack-pref-dim ;
|
||||||
|
|
Loading…
Reference in New Issue