Members
(static) allIds
Keeps track of ids that have been generated.
- Source:
- See:
(static) idN
The upper bound of random number generation for ids.
Increases if we get too close.
- Source:
- See:
Methods
(static) capitalize(string) → {string}
Capitalize the first letter of a string.
Often used for converting types into corresponding constructor function identifiers.
Parameters:
Name | Type | Description |
---|---|---|
string |
string | any string |
- Source:
Returns:
the passed string, with the first letter capitalized
- Type
- string
(static) checkArg(passed, require, default_value)
Ideal for checking argument types. Checks the passed value against the required type,
and returns the default value instead if the check doesn't pass.
A default value of '#undefined' will permit the type check to fail, and return nothing.
Otherwise (if default_value is actually undefined), will throw an error on type check failure.
Parameters:
Name | Type | Description |
---|---|---|
passed |
any value | |
require |
string | Array.<string> | function | a string representing the required type, an array of such strings, or a function returning true/false |
default_value |
any value, to be returned if the type check fails |
- Source:
(static) checkType(a, required_type) → {boolean}
Check a value against any given type(s).
Parameters:
Name | Type | Description |
---|---|---|
a |
any value | |
required_type |
string | Array.<string> | a string representing the required type, or an array of such strings |
- Source:
Returns:
whether the passed value matched the required type(s)
- Type
- boolean
(static) config(matrix, target)
Add properties to a given object, using that object's config_map property to check types and apply defaults.
Parameters:
Name | Type | Description |
---|---|---|
matrix |
object | An object of properties to be appended to the target |
target |
object | The object to be 'configured' |
- Source:
(static) distance(x1_or_obj, y1opt, x2opt, y2opt) → {number}
Get the distance between two points.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x1_or_obj |
number | object | either the x coordinate of point 1, or an object representing all four coordinates | |
y1 |
number |
<optional> |
the y coordinate of point 1 |
x2 |
number |
<optional> |
the x coordinate of point 2 |
y2 |
number |
<optional> |
the y coordinate of point 2 |
- Source:
Returns:
the distance between the two points
- Type
- number
(static) extend(parentConstructor, subConstructor, instance)
Extend parent class onto sub class, for instance.
Parameters:
Name | Type | Description |
---|---|---|
parentConstructor |
function | constructor function for the parent class |
subConstructor |
function | constructor function for the sub class |
instance |
object | the object instance being produced by subConstructor |
- Source:
(static) focusNoScroll(elem)
Just a function that allows us to focus an element without auto-scrolling to it.
Useful if the app is embedded in a larger page.
Parameters:
Name | Type | Description |
---|---|---|
elem |
jQuery_Object | A page element to scroll to |
- Source:
(static) genId() → {number}
Generates a unique id (unique within this session).
- Source:
- See:
Returns:
a session-unique id
- Type
- number
(static) getMidPoint(x1_or_obj, y1opt, x2opt, y2opt) → {object}
Get the mid point of a line spanning two points
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x1_or_obj |
number | object | either the x coordinate of point 1, or an object representing all four coordinates | |
y1 |
number |
<optional> |
the y coordinate of point 1 |
x2 |
number |
<optional> |
the x coordinate of point 2 |
y2 |
number |
<optional> |
the y coordinate of point 2 |
- Source:
Returns:
- the x/y coordinates of the mid point
- Type
- object
(static) typeOf(a) → {string}
Get the type of anything, taking into account all kinds of JS type weirdness.
Returns undefined for NaN and null. Returns specific object type if available, 'object' otherwise.
Parameters:
Name | Type | Description |
---|---|---|
a |
any value |
- Source:
Returns:
the type of the passed value
- Type
- string
(static) visualToActualCoordinates(x_or_object, yopt) → {object}
Take screen/visual coordinates and convert them to data coordinates based on the current transform matrix (from panning).
Basically, remove the effects of the transform matrix from the coordinates.
We need this because user mouse events give coordinates that include the transform, since that's what the user sees.
But we need to set internal coordinates that are based on a non-transformed coordinate field, since the transform matrix is the final layer of presentation, and shouldn't be contained in the lower level of data.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x_or_object |
number | object | the x coordinate, or an object containing the x and y coordinate | |
y |
number |
<optional> |
the y coordinate |
- Source:
Returns:
- x and y coordinates after accounting for transform matrix
- Type
- object