Constructor
new DrawLayer(containerDiv)
Name | Type | Description |
---|---|---|
containerDiv | HTMLDivElement | The layer div, its id will be used as this layer id. |
- Source
Classes
Methods
addEventListener(type, callback)
Add an event listener to this class.
Name | Type | Description |
---|---|---|
type | string | The event type. |
callback | function | The function associated with the provided event type, will be called with the fired event. |
- Source
addFlipOffsetX()
Add a flip offset along the layer X axis.
- Source
addFlipOffsetY()
Add a flip offset along the layer Y axis.
- Source
bindInteraction()
Enable and listen to container interaction events.
- Source
deleteDraw(id, exeCallback)
Delete a Draw from the stage.
Name | Type | Description |
---|---|---|
id | string | The id of the group to delete. |
exeCallback | object | The callback to call once the DeleteCommand has been executed. |
- Source
deleteDraws(exeCallback)
Delete all Draws from the stage.
Name | Type | Description |
---|---|---|
exeCallback | object | The callback to call once the DeleteCommand has been executed. |
- Source
display(flag)
Display the layer.
Name | Type | Description |
---|---|---|
flag | boolean | Whether to display the layer or not. |
- Source
draw()
Draw the content (imageData) of the layer. The imageData variable needs to be set
- Source
fitToContainer(fitScale1D, fitSize, fitOffset)
Fit the layer to its parent container.
Name | Type | Description |
---|---|---|
fitScale1D | number | The 1D fit scale. |
fitSize | object | The fit size as {x,y}. |
fitOffset | object | The fit offset as {x,y}. |
- Source
getBaseSize() → {object}
Get the layer base size (without scale).
- Source
The size as {x,y}.
- Type:
- object
getDataIndex() → {number}
Get the associated data index.
- Source
The index.
- Type:
- number
getDrawController() → {object}
Get the draw controller.
- Source
The controller.
- Type:
- object
getId() → {string}
Get the id of the layer.
- Source
The string id.
- Type:
- string
getKonvaLayer() → {object}
Get the Konva layer.
- Source
The layer.
- Type:
- object
getKonvaStage() → {object}
Get the Konva stage.
- Source
The stage.
- Type:
- object
getOpacity() → {number}
Get the layer opacity.
- Source
The opacity ([0:1] range).
- Type:
- number
initialise(size, spacing, index)
Initialise the layer: set the canvas and context
Name | Type | Description |
---|---|---|
size | object | The image size as {x,y}. |
spacing | object | The image spacing as {x,y}. |
index | number | The associated data index. |
- Source
isGroupVisible(id) → {boolean}
Check the visibility of a given group.
Name | Type | Description |
---|---|---|
id | string | The id of the group. |
- Source
True if the group is visible.
- Type:
- boolean
isVisible() → {boolean}
Check if the layer is visible.
- Source
True if the layer is visible.
- Type:
- boolean
removeEventListener(type, callback)
Remove an event listener from this class.
Name | Type | Description |
---|---|---|
type | string | The event type. |
callback | function | The function associated with the provided event type. |
- Source
setBaseOffset(scrollOffset, planeOffset) → {boolean}
Set the base layer offset. Updates the layer offset.
Name | Type | Description |
---|---|---|
scrollOffset | Vector3D | The scroll offset vector. |
planeOffset | Vector3D | The plane offset vector. |
- Source
True if the offset was updated.
- Type:
- boolean
setCurrentPosition(position, index) → {boolean}
Set the current position.
- Source
True if the position was updated.
- Type:
- boolean
setOffset(newOffset)
Set the layer offset.
Name | Type | Description |
---|---|---|
newOffset | object | The offset as {x,y}. |
- Source
setOpacity(alpha)
Set the layer opacity.
Name | Type | Description |
---|---|---|
alpha | number | The opacity ([0:1] range). |
- Source
setPlaneHelper(helper)
Set the plane helper.
Name | Type | Description |
---|---|---|
helper | object | The helper. |
- Source
setScale(newScale, centeropt)
Set the layer scale.
Name | Type | Attributes | Description |
---|---|---|---|
newScale | object | The scale as {x,y}. | |
center | Point3D | <optional> | The scale center. |
- Source
toggleGroupVisibility(id) → {boolean}
Toggle the visibility of a given group.
Name | Type | Description |
---|---|---|
id | string | The id of the group. |
- Source
False if the group cannot be found.
- Type:
- boolean
unbindInteraction()
Disable and stop listening to container interaction events.
- Source