Type Definitions
Area
Area object.
{left: number, top: number, right: number, bottom: number}
Name | Type | Description |
---|---|---|
left | number | Left coordinate |
top | number | Top coordinate |
right | number | Right coordinate |
bottom | number | Bottom coordinate |
BBox
Bounding box object.
{x: number, y: number, width: number, height: number}
Name | Type | Description |
---|---|---|
x | number | X coordinate |
y | number | Y coordinate |
width | number | Width of bounding box |
height | number | Height of bounding box |
Intersect
Intersect object.
{pts: Point[], ts1: number[], ts2: number[]}
Name | Type | Description |
---|---|---|
pts | Point[] | An array of intersected points, or an empty array if no intersections. |
ts | Array.<number[]> | Two arrays (0 === first segment, 1 === second segment) of T values for the intersected points. |
PathList
Path segment list. Contains an array of objects in the following format:
{type: string, x: number, y: number, x1: number, y1: number, x2: number, y2: number}
Name | Type | Attributes | Description |
---|---|---|---|
type | string | Valid svg path command limited to M, L, C, Q, Z | |
x | number | X coordinate | |
y | number | Y coordinate | |
x1 | number | optional | X control point for quadratic and bezier curve |
y1 | number | optional | Y control point for quadratic and bezier curve |
x2 | number | optional | Second X control point for bezier curve |
y2 | number | optional | Second Y control point for bezier curve |
length | number | The number of items in the path segment list |
Point
Point object.
{x: number, y: number}
Name | Type | Description |
---|---|---|
x | number | X coordinate |
y | number | Y coordinate |
Methods
.rollback(obj, selection)
Rollback document based on the object passed
Name | Type | Description |
---|---|---|
obj | Object containing the $doc, and the versioning data | |
selection | The selection array. Mutated here and to be used by the caller |
.scroll()
Helps to initiate event to trigger scrolling our pretty scroll. Everything else is ignored unless we found a pretty scroll bar in the given target. Across browsers, we are given 2 values to work on; deltaX and deltaY.
- deltaX (Returns positive number if you move to the left. Negative if to the right.)
- deltaY (Returns positive number if move down. Negative if move up.)
Using deltaX and deltaY, we know which direction you scroll to, and how much pixels you have traversed on your screen when you scroll. However, every browser returns you different number of pixels travelled. We can't take these numbers as face value since they are all so varied. Triggering a scroll just because there is a 1 pixel movement is pretty crazy because it would cause your scrolling to fly off! (Too sensitive)
So we have a minimum number (40px) that we use to determine if a certain amount of pixel traversed is enough to count as a "scroll".
.toggleGuide(guide)
Set or reset guide
Name | Type | Description |
---|---|---|
guide |