Fix grid-lines rendering

db4
Slava Pestov 2009-02-17 22:42:48 -06:00
parent 4c7405f353
commit eb54b95b37
3 changed files with 30 additions and 16 deletions

View File

@ -6,10 +6,10 @@ ui.gadgets.grids.private accessors arrays ui.gadgets.grids sorting kernel ;
[ [
{ {
{ { 0 0 } { 0 100 } } { { 0 0 } { 0 101 } }
{ { 0 0 } { 100 0 } } { { 0 0 } { 101 0 } }
{ { 0 100 } { 100 100 } } { { 0 100 } { 101 100 } }
{ { 100 0 } { 100 100 } } { { 100 0 } { 100 101 } }
} }
] [ ] [
100x100 1array 100x100 1array
@ -21,10 +21,10 @@ ui.gadgets.grids.private accessors arrays ui.gadgets.grids sorting kernel ;
[ [
{ {
{ { 5 5 } { 5 115 } } { { 5 5 } { 5 116 } }
{ { 5 5 } { 115 5 } } { { 5 5 } { 116 5 } }
{ { 5 115 } { 115 115 } } { { 5 115 } { 116 115 } }
{ { 115 5 } { 115 115 } } { { 115 5 } { 115 116 } }
} }
] [ ] [
100x100 1array 100x100 1array
@ -37,12 +37,12 @@ ui.gadgets.grids.private accessors arrays ui.gadgets.grids sorting kernel ;
[ [
{ {
{ { 0 0 } { 0 200 } } { { 0 0 } { 0 201 } }
{ { 0 0 } { 200 0 } } { { 0 0 } { 201 0 } }
{ { 0 100 } { 200 100 } } { { 0 100 } { 201 100 } }
{ { 0 200 } { 200 200 } } { { 0 200 } { 201 200 } }
{ { 100 0 } { 100 200 } } { { 100 0 } { 100 201 } }
{ { 200 0 } { 200 200 } } { { 200 0 } { 200 201 } }
} }
] [ ] [
100x100 100x100 2array 100x100 100x100 2array
@ -52,3 +52,17 @@ ui.gadgets.grids.private accessors arrays ui.gadgets.grids sorting kernel ;
{ 200 200 } >>dim { 200 200 } >>dim
compute-grid-lines natural-sort compute-grid-lines natural-sort
] unit-test ] unit-test
[
{
{ { 0 0 } { 0 3 } }
{ { 2 0 } { 2 3 } }
{ { 0 0 } { 3 0 } }
{ { 0 2 } { 3 2 } }
}
] [
<gadget> { 1 1 } >>dim
1array 1array <grid> { 1 1 } >>gap
dup prefer
compute-grid-lines
] unit-test

View File

@ -15,7 +15,7 @@ C: <grid-lines> grid-lines
:: (compute-grid-lines) ( grid n ns orientation -- seq ) :: (compute-grid-lines) ( grid n ns orientation -- seq )
grid gap>> :> gap grid gap>> :> gap
ns n suffix gap orientation v. '[ _ - orientation n*v ] map ns n suffix gap orientation v. '[ _ - orientation n*v ] map
dup grid dim>> gap v- orientation reverse v* '[ _ v+ ] map dup grid dim>> gap v- orientation reverse [ v* ] keep '[ _ _ v+ v+ ] map
[ [ gap [ 2/ ] map v+ ] map ] bi@ zip ; [ [ gap [ 2/ ] map v+ ] map ] bi@ zip ;
: compute-grid-lines ( grid -- lines ) : compute-grid-lines ( grid -- lines )

View File

@ -162,7 +162,7 @@ M: table layout*
: column-loc ( font column width align -- loc ) : column-loc ( font column width align -- loc )
[ [ cell-width ] dip swap - ] dip [ [ cell-width ] dip swap - ] dip
* 0 2array ; * >integer 0 2array ;
: translate-column ( width gap -- ) : translate-column ( width gap -- )
+ 0 2array gl-translate ; + 0 2array gl-translate ;