MathCanvas.RectList Class
Manages all the bounding rectangles for an expression.
Each item contains rect (top,left,bottom,right), midline, font_size(%), func.
Constructor
MathCanvas.RectList
()
Item Index
Methods
- add
- area static
- containsPt static
- containsRect static
- cover static
- find
- findIndex
- get
- getBounds
- getParent
- getSelection
- height static
- setMidline
- shift
- size
- width static
- xcenter static
- ycenter static
Methods
add
-
r -
midline -
font_size -
func
Parameters:
-
rRect -
midlineInt -
font_sizeIntpercentage
-
funcMathFunction
Returns:
index of inserted item
containsPt
-
r -
xy
Parameters:
-
rRectrectangle
-
xyPointpoint
Returns:
true if rectangle contains point
cover
-
r1 -
r2
Returns:
rectangle convering both input arguments
find
-
f
Parameters:
-
fMathFunctionsearch target
Returns:
data for specified MathFunction, or null if not found
findIndex
-
f
Parameters:
-
fMathFunctionsearch target
Returns:
index of item for specified MathFunction, or -1 if not found
get
-
index
Parameters:
-
indexInt
Returns:
item at index
getBounds
()
Returns:
the bounding rect of all the rects in the list
getParent
-
index
Returns the index of the smallest rectangle enclosing the given one.
Parameters:
-
indexInt
getSelection
-
start_pt -
curr_pt
Returns the index of the smallest rectangle that contains both startPt and currPt. Returns -1 if there is no such rectangle. If startPt is inside the bounding rectangle and currPt is outside, we return the index of the bounding rectangle.
Parameters:
-
start_ptPointpoint where the drag started
-
curr_ptPointcurrent cursor location
setMidline
-
index -
y
Set the midline of the specified rectangle.
Parameters:
-
indexInt -
yIntmidline
shift
-
index -
dx -
dy
Shift the specified rect and all rects inside it.
Parameters:
-
indexInt -
dxInthorizontal shift
-
dyIntvertical shift
size
()
Returns:
number of items
