Class: PlotBoilerplate
PlotBoilerplate(config)
new PlotBoilerplate(config)
The constructor.
Parameters:
Name | Type | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | {} | The configuration.
Properties
|
- Source:
Methods
add(drawable, redrawopt) → {void}
Add a drawable object.
This must be either:
This must be either:
* a Vertex * a Line * a Vector * a VEllipse * a Circle * a Polygon * a Triangle * a BezierPath * a BPImage
Parameters:
- Source:
Returns:
- Type
- void
createGUI() → {dat.gui.GUI}
Creates a control GUI (a dat.gui instance) for this
plot boilerplate instance.
- Source:
Returns:
- Type
- dat.gui.GUI
getDraggedElementCount() → {number}
Determine if any elements are currently being dragged (on mouse move or touch move).
- Source:
Returns:
The number of elements that are currently being dragged.
- Type
- number
redraw() → {void}
Trigger redrawing of all objects.
Usually this function is automatically called when objects change.
Usually this function is automatically called when objects change.
- Source:
Returns:
- Type
- void
remove(drawable, redrawopt) → {void}
Remove a drawable object.
This must be either:
This must be either:
* a Vertex * a Line * a Vector * a VEllipse * a Circle * a Polygon * a BezierPath * a BPImage * a Triangle
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
drawable |
Object | The drawable (of one of the allowed class instance) to remove. | ||
redraw |
boolean |
<optional> |
false |
- Source:
Returns:
- Type
- void
removeVertex(vert, redrawopt) → {void}
Remove a vertex from the vertex list.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
vert |
Vertex | The vertex to remove. | ||
redraw |
boolean |
<optional> |
false |
- Source:
Returns:
- Type
- void
resizeCanvas() → {void}
This function resizes the canvas to the required settings (toggles fullscreen).
This function is usually only used internally but feel free to call it if resizing required.
This function is usually only used internally but feel free to call it if resizing required.
- Source:
Returns:
- Type
- void
revertMousePosition(x, y) → {XYCoords}
Revert a transformed mouse position back to canvas coordinates.
This is the inverse function of `transformMousePosition`.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x component of the position to revert. |
y |
number | The y component of the position to revert. |
- Source:
Returns:
The canvas coordinates for the given position.
- Type
- XYCoords
saveFile() → {void}
Trigger the saveFile.hook.
- Source:
Returns:
- Type
- void
selectVerticesInPolygon(polygon) → {void}
Add all vertices inside the polygon to the current selection.
Parameters:
Name | Type | Description |
---|---|---|
polygon |
Polygon | The polygonal selection area. |
- Source:
Returns:
- Type
- void
setConsole(con) → {void}
Set the console for this instance.
Parameters:
Name | Type | Description |
---|---|---|
con |
Console | The new console object (default is globalThis.console). |
- Source:
Returns:
- Type
- void
transformMousePosition(x, y) → {XYCoords}
Transforms the given x-y-(mouse-)point to coordinates respecting the view offset
and the zoom settings.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x position relative to the canvas. |
y |
number | The y position relative to the canvas. |
- Source:
Returns:
A simple object
{ x : Number, y : Number }with the transformed coordinates.
- Type
- XYCoords
viewPort() → {Bounds}
Get the current view port.
- Source:
Returns:
The current viewport.
- Type
- Bounds