Don't position popups at negative x co-ordinates
parent
f0bc2e1176
commit
d186f10f52
|
@ -36,4 +36,11 @@ IN: math.rectangles.positioning.tests
|
||||||
{ 50 50 }
|
{ 50 50 }
|
||||||
{ 100 100 }
|
{ 100 100 }
|
||||||
popup-loc
|
popup-loc
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
[ { 0 20 } ] [
|
||||||
|
{ -50 70 } { 0 0 } <rect>
|
||||||
|
{ 50 50 }
|
||||||
|
{ 100 100 }
|
||||||
|
popup-loc
|
||||||
] unit-test
|
] unit-test
|
|
@ -7,7 +7,7 @@ IN: math.rectangles.positioning
|
||||||
! in a semi-intelligent manner
|
! in a semi-intelligent manner
|
||||||
|
|
||||||
: popup-x ( visible-rect popup-dim screen-dim -- x )
|
: popup-x ( visible-rect popup-dim screen-dim -- x )
|
||||||
[ loc>> first ] 2dip swap [ first ] bi@ - min ;
|
[ loc>> first ] 2dip swap [ first ] bi@ - min 0 max ;
|
||||||
|
|
||||||
: preferred-y ( visible-rect -- y )
|
: preferred-y ( visible-rect -- y )
|
||||||
[ loc>> ] [ dim>> ] bi [ second ] bi@ + ;
|
[ loc>> ] [ dim>> ] bi [ second ] bi@ + ;
|
||||||
|
|
Loading…
Reference in New Issue