rect
Factor documentation > Factor handbook > UI framework > Building user interfaces > Gadget geometry > Rectangles
Next:rect-bounds ( rect -- loc dim )


Vocabulary
math.rectangles

Class description
A rectangle with the following slots:
loc - the top-left corner of the rectangle as an x/y pair
dim - the dimensions of the rectangle as a width/height pair

Rectangles are constructed by calling <rect> and <extent-rect>.

Definition
IN: math.rectangles

TUPLE: rect { loc initial: { 0 0 } } { dim initial: { 0 0 } } ;


Methods
USING: kernel math.rectangles ;

M: rect contains-point? [ point>rect ] dip contains-rect? ;


USING: kernel math.rectangles math.vectors ;

M: rect contains-rect? (rect-intersect) [v-] { 0 0 } = ;


USING: accessors kernel math.rectangles prettyprint.backend
prettyprint.custom ;

M: rect pprint*
[
\ RECT:
[ [ loc>> ] [ dim>> ] bi [ pprint* ] bi@ ]
pprint-prefix
] check-recursion ;


USING: kernel math.rectangles ui.gadgets.scrollers.private ;

M: rect update-scroller swap (scroll>rect) ;