ToolDefinition
An interactive tool a plugin adds, which the user picks from the Extensions menu or the toolbar like a built-in tool. See PluginContext.registerTool.
Handlers run once per frame for what happened since the last one, in order, and may edit
the model inside Model.operation. They must be synchronous. After them,
draw describes the preview, which shows until the next run.
Properties
Section titled “Properties”
optionalicon?:string
An SVG file in the plugin folder, as for CommandDefinition.icon.
id:
string
Identifies the tool within its plugin: letters, digits, dots, dashes or underscores.
shortcut?
Section titled “shortcut?”
optionalshortcut?:string
A keyboard shortcut, as for CommandDefinition.shortcut.
optionalsnap?:boolean
Whether the pointer snaps and shows inferences like the drawing tools; true by default.
Tools that only pick what is under the pointer turn it off, and their events have no point.
optionaltip?:string
title:
string
The tool’s name, in its menu entry, tooltip and the status bar.
toolbar?
Section titled “toolbar?”
optionaltoolbar?:boolean
Also show the tool in the plugin’s toolbar group. Needs an icon.
Methods
Section titled “Methods”activate()?
Section titled “activate()?”
optionalactivate(event):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
deactivate()?
Section titled “deactivate()?”
optionaldeactivate(event):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
draw()?
Section titled “draw()?”
optionaldraw(view):void
Describes the preview drawn over the model.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onCancel()?
Section titled “onCancel()?”
optionalonCancel(reason,event):void
Escape, picking another tool or undo ended the gesture.
Parameters
Section titled “Parameters”reason
Section titled “reason”NonNullable<"escape" | "reselected" | "history" | "focusLost" | null>
Returns
Section titled “Returns”void
onDoubleClick()?
Section titled “onDoubleClick()?”
optionalonDoubleClick(event):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onKeyDown()?
Section titled “onKeyDown()?”
optionalonKeyDown(event):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onKeyUp()?
Section titled “onKeyUp()?”
optionalonKeyUp(event):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onMouseDown()?
Section titled “onMouseDown()?”
optionalonMouseDown(event):void
The left button went down; the right button opens the context menu instead.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onMouseMove()?
Section titled “onMouseMove()?”
optionalonMouseMove(event):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onMouseUp()?
Section titled “onMouseUp()?”
optionalonMouseUp(event):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onValue()?
Section titled “onValue()?”
optionalonValue(text,event):void
The user typed in the measurement box and pressed Enter. Read lengths with Model.parseLength.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
options()?
Section titled “options()?”
optionaloptions(ui):void
Draws the tool’s options, in a card over the top left of the viewport while the tool is selected, with the same widgets as panels. Changing an option keeps the tool’s gesture going, and the preview draws again.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
resume()?
Section titled “resume()?”
optionalresume(event):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
suspend()?
Section titled “suspend()?”
optionalsuspend(event):void
A navigation tool, such as Orbit with the middle button, takes over for a while.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void