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:
-
r
Rect -
midline
Int -
font_size
Intpercentage
-
func
MathFunction
Returns:
index of inserted item
containsPt
-
r
-
xy
Parameters:
-
r
Rectrectangle
-
xy
Pointpoint
Returns:
true if rectangle contains point
cover
-
r1
-
r2
Returns:
rectangle convering both input arguments
find
-
f
Parameters:
-
f
MathFunctionsearch target
Returns:
data for specified MathFunction, or null if not found
findIndex
-
f
Parameters:
-
f
MathFunctionsearch target
Returns:
index of item for specified MathFunction, or -1 if not found
get
-
index
Parameters:
-
index
Int
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:
-
index
Int
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_pt
Pointpoint where the drag started
-
curr_pt
Pointcurrent cursor location
setMidline
-
index
-
y
Set the midline of the specified rectangle.
Parameters:
-
index
Int -
y
Intmidline
shift
-
index
-
dx
-
dy
Shift the specified rect and all rects inside it.
Parameters:
-
index
Int -
dx
Inthorizontal shift
-
dy
Intvertical shift
size
()
Returns:
number of items