Constructor
new DrawLayer(containerDiv)
Name | Type | Description |
---|---|---|
containerDiv | HTMLDivElement | The layer div, its id will be used as this layer id. |
- Source
Classes
Methods
activateCurrentPositionShapes(flag)
Activate shapes at current position.
Name | Type | Description |
---|---|---|
flag | boolean | The flag to activate or not. |
- Source
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 | function | The callback to call once the DeleteCommand has been executed. |
- Deprecated
- Since v0.34, please switch to `annotationGroup.remove`.
- Source
deleteDraws(_exeCallback)
Delete all Draws from the stage.
Name | Type | Description |
---|---|---|
_exeCallback | function | The callback to call once the DeleteCommand has been executed. |
- Deprecated
- Since v0.34, please switch to `annotationGroup.remove`.
- 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(containerSize, divToWorldSizeRatio, fitOffset)
Fit the layer to its parent container.
Name | Type | Description |
---|---|---|
containerSize | Scalar2D | The container size as {x,y}. |
divToWorldSizeRatio | number | The div to world size ratio. |
fitOffset | Scalar2D | The fit offset as {x,y}. |
- Source
flipScaleX()
Flip the scale along the layer X axis.
- Source
flipScaleY()
Flip the scale along the layer Y axis.
- Source
flipScaleZ()
Flip the scale along the layer Z axis.
- Source
getBaseSize() → {Scalar2D}
Get the layer base size (without scale).
- Source
The size as {x,y}.
- Type:
- Scalar2D
getCurrentPosGroup() → {Konva.Group|undefined}
Get the current position group.
- Source
The Konva.Group.
- Type:
- Konva.
Group |undefined
getDataId() → {string}
Get the associated data id.
- Source
The id.
- Type:
- string
getDrawController() → {DrawController}
Get the draw controller.
- Source
The controller.
- Type:
- DrawController
getGroup(id) → {object|undefined}
Get a Konva group using its id.
Name | Type | Description |
---|---|---|
id | string | The group id. |
- Source
The Konva group.
- Type:
- object |
undefined
getId() → {string}
Get the id of the layer.
- Source
The string id.
- Type:
- string
getKonvaLayer() → {Konva.Layer}
Get the Konva layer.
- Source
The layer.
- Type:
- Konva.
Layer
getKonvaStage() → {Konva.Stage}
Get the Konva stage.
- Source
The stage.
- Type:
- Konva.
Stage
getNumberOfDraws() → {number|undefined}
Get the total number of draws of this layer (at all positions).
- Source
The total number of draws.
- Type:
- number |
undefined
getOpacity() → {number}
Get the layer opacity.
- Source
The opacity ([0:1] range).
- Type:
- number
getReferenceLayerId() → {string}
Get the reference data id.
- Source
The id.
- Type:
- string
initScale(newScale, absoluteZoomOffset)
Initialise the layer scale.
Name | Type | Description |
---|---|---|
newScale | Scalar3D | The scale as {x,y,z}. |
absoluteZoomOffset | Scalar2D | The zoom offset as {x,y} without the fit scale (as provided by getAbsoluteZoomOffset). |
- Source
initialise(size, spacing, refLayerId)
Initialise the layer: set the canvas and context.
Name | Type | Description |
---|---|---|
size | Scalar2D | The image size as {x,y}. |
spacing | Scalar2D | The image spacing as {x,y}. |
refLayerId | string | The reference image dataId. |
- Source
isAnnotationVisible(id) → {boolean}
Check the visibility of an annotation.
Name | Type | Description |
---|---|---|
id | string | The id of the annotation. |
- Source
True if the annotation 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
removeFromDOM()
Remove the HTML element from the DOM.
- Source
setAnnotationGroup(annotationGroup, dataId, exeCallback)
Set the annotation group.
Name | Type | Description |
---|---|---|
annotationGroup | AnnotationGroup | The annotation group. |
dataId | string | The associated data id. |
exeCallback | object | The undo stack callback. |
- Source
setAnnotationVisibility(id, visibleopt) → {boolean}
Set the visibility of an annotation.
Name | Type | Attributes | Description |
---|---|---|---|
id | string | The id of the annotation. | |
visible | boolean | <optional> | True to set to visible, will toggle visibility if not defined. |
- Source
False if the annotation shape cannot be found.
- Type:
- boolean
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, indexopt) → {boolean}
Set the current position.
Name | Type | Attributes | Description |
---|---|---|---|
position | Point | The new position. | |
index | Index | <optional> | Optional coresponding index. |
- Source
True if the position was updated.
- Type:
- boolean
setLabelVisibility(shapeGroup)
Set a shape group label visibility according to this layer setting.
Name | Type | Description |
---|---|---|
shapeGroup | Konva. | The shape group. |
- Source
setLabelsVisibility(visibleopt)
Set the visibility of all labels.
Name | Type | Attributes | Description |
---|---|---|---|
visible | boolean | <optional> | True to set to visible, will toggle visibility if not defined. |
- Source
setOffset(newOffset)
Set the layer offset.
Name | Type | Description |
---|---|---|
newOffset | Scalar3D | The offset as {x,y,z}. |
- 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 | PlaneHelper | The helper. |
- Source
setScale(newScale, centeropt)
Set the layer scale.
Name | Type | Attributes | Description |
---|---|---|---|
newScale | Scalar3D | The scale as {x,y,z}. | |
center | Point3D | <optional> | The scale center. |
- Source
setShapeHandler(handler)
Set the draw shape handler.
Name | Type | Description |
---|---|---|
handler | DrawShapeHandler | | The shape handler. |
- Source
unbindInteraction()
Disable and stop listening to container interaction events.
- Source