Methods
# addComponent(c, render) → {void}
Add a component to the viewport that will be rendered inside.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
c |
Component
|
object
|
The component to add. |
|
render |
function
|
(el)=>el.createSVGElement() | The function that will be called to render the component. It has to return an HTMLElement of any type. |
void
# move(deltaX, deltaY) → {Position}
Move the component relative to its current position.
Parameters:
Name | Type | Description |
---|---|---|
deltaX |
number
|
The amount of |
deltaY |
number
|
description |
The new position
# setPosition(pos) → {void}
Set the position of the viewport in the parent. This will move the children as well.
Parameters:
Name | Type | Description |
---|---|---|
pos |
object
|
The new position of the viewport. |
x |
number
|
The new x position. |
y |
number
|
The new y position. |
void
# setViewboxScale(newScale) → {void}
Change the scale of the element using the viewBox property.
Parameters:
Name | Type | Description |
---|---|---|
newScale |
number
|
The new scale of the element |
void