Class: ToolBase

OSDPaperjsAnnotation.ToolBase(paperScope)

The ToolBase Class

Constructor

new ToolBase(paperScope)

Create a new instance of ToolBase.
Parameters:
Name Type Description
paperScope paper.PaperScope The Paper.js PaperScope object.
Source:

Methods

addEventListener(eventType, callback)

Add an event listener for a specific event type.
Parameters:
Name Type Description
eventType string The type of event to listen for.
callback function The callback function to be executed when the event occurs.
Source:

broadcast(eventType, …data)

Broadcast an event to all registered event listeners for the specified event type.
Parameters:
Name Type Attributes Description
eventType string The type of event to broadcast.
data * <repeatable>
Data to be passed as arguments to the event listeners.
Source:

isActive() → {boolean}

Check if the tool is active.
Source:
Returns:
True if the tool is active, otherwise false.
Type
boolean

onActivate()

Function called when the tool is activated.
Source:

onDeactivate(shouldFinishopt)

Function called when the tool is deactivated.
Parameters:
Name Type Attributes Default Description
shouldFinish boolean <optional>
false Indicates whether the tool should finish its action.
Source:

projectInterface()

The project interface object containing various properties. If a layer in the current project exists that is named "toolLayer" it will be used by the tool for graphical display , the current active layer will be used as the tool layer.
Properties:
Name Type Description
getZoom function A function to get the current zoom level.
toolLayer paper.Layer The layer used by the tool for graphical display.
paperScope paper.PaperScope The Paper.js PaperScope object.
overlay Element The overlay element used by the tool.
Source: