new DrawLayer(containerDiv)
- Source:
Draw layer.
Parameters:
Name | Type | Description |
---|---|---|
containerDiv |
HTMLElement | The layer div, its id will be used as this layer id. |
Methods
addEventListener(type, callback)
- Source:
Add an event listener to this class.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The event type. |
callback |
object | The method associated with the provided event type, will be called with the fired event. |
bindInteraction()
- Source:
Enable and listen to container interaction events.
display(flag)
- Source:
Display the layer.
Parameters:
Name | Type | Description |
---|---|---|
flag |
boolean | Whether to display the layer or not. |
draw()
- Source:
Draw the content (imageData) of the layer. The imageData variable needs to be set
fitToContainer(fitScale1D)
- Source:
Fit the layer to its parent container.
Parameters:
Name | Type | Description |
---|---|---|
fitScale1D |
number | The 1D fit scale. |
getBaseSize() → {object}
- Source:
Get the layer base size (without scale).
Returns:
The size as {x,y}.
- Type
- object
getDataIndex() → {number}
- Source:
Get the associated data index.
Returns:
The index.
- Type
- number
getDrawController() → {object}
- Source:
Get the draw controller.
Returns:
The controller.
- Type
- object
getFullSize() → {object}
- Source:
Get the data full size, ie size * spacing.
Returns:
The full size as {x,y}.
- Type
- object
getId() → {string}
- Source:
Get the id of the layer.
Returns:
The string id.
- Type
- string
getKonvaLayer() → {object}
- Source:
Get the Konva layer.
Returns:
The layer.
- Type
- object
getKonvaStage() → {object}
- Source:
Get the Konva stage.
Returns:
The stage.
- Type
- object
getOpacity() → {number}
- Source:
Get the layer opacity.
Returns:
The opacity ([0:1] range).
- Type
- number
initialise(size, spacing, index)
- Source:
Initialise the layer: set the canvas and context
Parameters:
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. |
isVisible() → {boolean}
- Source:
Check if the layer is visible.
Returns:
True if the layer is visible.
- Type
- boolean
removeEventListener(type, callback)
- Source:
Remove an event listener from this class.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The event type. |
callback |
object | The method associated with the provided event type. |
setBaseOffset(off)
- Source:
Set the base layer offset. Resets the layer offset.
Parameters:
Name | Type | Description |
---|---|---|
off |
object | The offset as {x,y}. |
setCurrentPosition(position, index)
- Source:
Set the current position.
Parameters:
Name | Type | Description |
---|---|---|
position |
dwv.math.Point | The new position. |
index |
dwv.math.Index | The new index. |
setOffset(newOffset)
- Source:
Set the layer offset.
Parameters:
Name | Type | Description |
---|---|---|
newOffset |
object | The offset as {x,y}. |
setOpacity(alpha)
- Source:
Set the layer opacity.
Parameters:
Name | Type | Description |
---|---|---|
alpha |
number | The opacity ([0:1] range). |
setPlaneHelper(helper)
- Source:
Set the plane helper.
Parameters:
Name | Type | Description |
---|---|---|
helper |
object | The helper. |
setScale(newScale)
- Source:
Set the layer scale.
Parameters:
Name | Type | Description |
---|---|---|
newScale |
object | The scale as {x,y}. |
unbindInteraction()
- Source:
Disable and stop listening to container interaction events.
(inner) updateLabelScale(scale)
- Source:
Update label scale: compensate for it so that label size stays visually the same.
Parameters:
Name | Type | Description |
---|---|---|
scale |
object | The scale to compensate for as {x,y}. |