API Docs for: 1.0.0
Show:

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

Methods

add

(
  • r
  • midline
  • font_size
  • func
)

Parameters:

Returns:

index of inserted item

area

(
  • r
)
static

Parameters:

Returns:

area

containsPt

(
  • r
  • xy
)
static

Parameters:

  • r Rect

    rectangle

  • xy Point

    point

Returns:

true if rectangle contains point

containsRect

(
  • r1
  • r2
)
static

Parameters:

Returns:

true if r1 contains r2

cover

(
  • r1
  • r2
)
static

Parameters:

Returns:

rectangle convering both input arguments

find

(
  • f
)

Parameters:

Returns:

data for specified MathFunction, or null if not found

findIndex

(
  • f
)

Parameters:

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 Point

    point where the drag started

  • curr_pt Point

    current cursor location

height

(
  • r
)
static

Parameters:

Returns:

height

setMidline

(
  • index
  • y
)

Set the midline of the specified rectangle.

Parameters:

  • index Int
  • y Int

    midline

shift

(
  • index
  • dx
  • dy
)

Shift the specified rect and all rects inside it.

Parameters:

  • index Int
  • dx Int

    horizontal shift

  • dy Int

    vertical shift

size

()

Returns:

number of items

width

(
  • r
)
static

Parameters:

Returns:

width

xcenter

(
  • r
)
static

Parameters:

Returns:

horizontal center

ycenter

(
  • r
)
static

Parameters:

Returns:

vertical center