new Draw(app)
Drawing tool.
This tool is responsible for the draw layer group structure. The layout is:
drawLayer |_ positionGroup: name="position-group", id="#2-0##3-1"" | shapeGroup: name="{shape name}-group", id="#" |_ shape: name="shape" |_ label: name="label" |_ extra: line tick, protractor arc...
Discussion:
- posGroup > shapeGroup pro: slice/frame display: 1 loop cons: multi-slice shape splitted in positionGroups
- shapeGroup > posGroup pros: more logical cons: slice/frame display: 2 loops
Name | Type | Description |
---|---|---|
app | dwv. | The associated application. |
- Source
Members
shapeFactoryList :object
Shape factory list
- object
- Source
shapeName :string
Shape name.
- string
- Source
style :dwv.gui.Style
Drawing style.
- Source
(inner) scrollWhell :dwv.tool.ScrollWheel
Scroll wheel handler.
- Source
Methods
activate(flag)
Activate the tool.
Name | Type | Description |
---|---|---|
flag | boolean | The flag to activate or not. |
- Source
addEventListener(type, listener)
Add an event listener on the app.
Name | Type | Description |
---|---|---|
type | string | The event type. |
listener | object | The method associated with the provided event type. |
- Source
dblclick(event)
Handle double click event: some tools use it to finish interaction.
Name | Type | Description |
---|---|---|
event | object | The double click event. |
- Source
getEventNames() → {Array}
Get the list of event names that this tool can fire.
- Source
The list of event names.
- Type:
- Array
getOptionsType() → {string}
Get the type of tool options: here 'factory' since the shape list contains factories to create each possible shape.
- Source
The type.
- Type:
- string
hasShape(name) → {boolean}
Check if the shape is in the shape list.
Name | Type | Description |
---|---|---|
name | string | The name of the shape. |
- Source
True if there is a factory for the shape.
- Type:
- boolean
init()
Initialise the tool.
- Source
keydown(event)
Handle key down event.
Name | Type | Description |
---|---|---|
event | object | The key down event. |
- Source
mousedown(event)
Handle mouse down event.
Name | Type | Description |
---|---|---|
event | object | The mouse down event. |
- Source
mousemove(event)
Handle mouse move event.
Name | Type | Description |
---|---|---|
event | object | The mouse move event. |
- Source
mouseout(event)
Handle mouse out event.
Name | Type | Description |
---|---|---|
event | object | The mouse out event. |
- Source
mouseup(event)
Handle mouse up event.
Name | Type | Description |
---|---|---|
event | object | The mouse up event. |
- Source
removeEventListener(type, listener)
Remove an event listener from the app.
Name | Type | Description |
---|---|---|
type | string | The event type. |
listener | object | The method associated with the provided event type. |
- Source
setFeatures(features)
Set the tool live features: shape colour and shape name.
Name | Type | Description |
---|---|---|
features | object | The list of features. |
- Source
setOptions(options)
Set the tool configuration options.
Name | Type | Description |
---|---|---|
options | object | The list of shape names amd classes. |
- Source
setShapeOn(shapeGroup, layerGroup)
Set shape group on properties.
Name | Type | Description |
---|---|---|
shapeGroup | object | The shape group to set on. |
layerGroup | dwv. | The origin layer group. |
- Source
touchend(event)
Handle touch end event.
Name | Type | Description |
---|---|---|
event | object | The touch end event. |
- Source
touchmove(event)
Handle touch move event.
Name | Type | Description |
---|---|---|
event | object | The touch move event. |
- Source
touchstart(event)
Handle touch start event.
Name | Type | Description |
---|---|---|
event | object | The touch start event. |
- Source
wheel(event)
Handle mouse wheel event.
Name | Type | Description |
---|---|---|
event | object | The mouse wheel event. |
- Source
(inner) activateCurrentPositionShapes(visible, layerGroup)
Activate shapes at current position.
Name | Type | Description |
---|---|---|
visible | boolean | Set the draw layer visible or not. |
layerGroup | dwv. | The origin layer group. |
- Source
(inner) onFinalPoints(finalPoints, layerGroup)
Create the final shape from a point list.
Name | Type | Description |
---|---|---|
finalPoints | Array | The array of points. |
layerGroup | dwv. | The origin layer group. |
- Source
(inner) onNewPoints(tmpPoints, layerGroup)
Update the current draw with new points.
Name | Type | Description |
---|---|---|
tmpPoints | Array | The array of new points. |
layerGroup | dwv. | The origin layer group. |
- Source
(inner) resetActiveShapeGroup()
Reset the active shape group and mouse cursor to their original state.
- Source
(inner) setShapeOff(shapeGroup)
Set shape group off properties.
Name | Type | Description |
---|---|---|
shapeGroup | object | The shape group to set off. |
- Source
(inner) updateDrawLayer(layerGroup)
Update the draw layer.
Name | Type | Description |
---|---|---|
layerGroup | dwv. | The origin layer group. |
- Source