new PlotBoilerplate(config)
The constructor.
Parameters:
Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | {} | The configuration.
Properties
|
- Source:
Methods
add(drawable:Object, redrawopt) → {void}
Add a drawable object.
This must be either:
This must be either:
* a Vertex * a Line * a Vector * a VEllipse * a Polygon * a BezierPath * a BPImage
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
drawable:Object |
Object | The drawable (of one of the allowed class instance) to add. | ||
redraw |
boolean |
<optional> |
true |
- Source:
Returns:
- Type
- void
createGUI() → {dat.gui}
Creates a control GUI (a dat.gui instance) for this
plot boilerplate instance.
- Source:
Returns:
- Type
- dat.gui
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
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
saveFile() → {void}
This function opens a save-as file dialog and – once an output file is
selected – stores the current canvas contents as an SVG image.
- 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 |
object | The new console object (default is window.console). |
- Source:
Returns:
- Type
- void
transformMousePosition(x, y) → {object}
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
- object