Handbook
Glossary
relative-loc ( fromgadget togadget -- loc )
Factor handbook
»
UI framework
»
Building user interfaces
»
Gadget geometry
Prev:
Rectangles
Next:
screen-loc ( gadget -- loc )
Vocabulary
ui
.
gadgets
Inputs
fromgadget
a
gadget
togadget
a
gadget
Outputs
loc
a pair of integers
Word description
Outputs the location of the top-left corner of
togadget
relative to the coordinate system of
fromgadget
.
Errors
Throws an error if
togadget
is not contained in a child of
fromgadget
.
Definition
USING:
accessors
kernel
math.vectors
;
IN:
ui.gadgets
:
relative-loc
( fromgadget togadget -- loc )
2dup
eq?
[
2drop
{
0 0
}
]
[
[
[
parent>>
]
dip
relative-loc
]
[
drop
loc>>
]
2bi
v+
]
if
;