ToolsController
Last updated
Was this helpful?
Last updated
Was this helpful?
The Tools controller allows you to let users draw elements on the map.
setTool(
tool
:null
|"text"
|"note"
|"pin"
|"line"
|"route"
|"polygon"
|"circle"
|"marker"
|"highlighter"
|"link"
):void
Sets the tool to use for drawing elements on the map.
tool
null
| "text"
| "note"
| "pin"
| "line"
| "route"
| "polygon"
| "circle"
| "marker"
| "highlighter"
| "link"
The tool to set.
void
getTool():
Promise
<null
|"text"
|"note"
|"pin"
|"line"
|"route"
|"polygon"
|"circle"
|"marker"
|"highlighter"
|"link"
>
Gets the current tool, if any is in use.
Promise
<null
| "text"
| "note"
| "pin"
| "line"
| "route"
| "polygon"
| "circle"
| "marker"
| "highlighter"
| "link"
>
The current tool, or null
if no tool is in use.
onToolChange(
args
: {handler
: (tool
:null
|"text"
|"note"
|"pin"
|"line"
|"route"
|"polygon"
|"circle"
|"marker"
|"highlighter"
|"link"
) =>void
; }):VoidFunction
Listens for changes to the current tool.
args
{ handler
: (tool
: null
| "text"
| "note"
| "pin"
| "line"
| "route"
| "polygon"
| "circle"
| "marker"
| "highlighter"
| "link"
) => void
; }
-
args.handler
(tool
: null
| "text"
| "note"
| "pin"
| "line"
| "route"
| "polygon"
| "circle"
| "marker"
| "highlighter"
| "link"
) => void
This callback is called with the current tool whenever the tool changes.
VoidFunction
A function to unsubscribe from the listener
Sets the settings for the current tool.
settings
The settings to set.
void
Gets the settings for the chosen tool
tool
T
The settings for the chosen tool.
Listens for changes to the settings on all tools.
args
args.handler
VoidFunction
A function to unsubscribe from the listener
setToolSettings(settings
: ): void
getToolSettings<T
>(tool
: T
): Promise
<[T
]>
T
extends keyof
Promise
<[T
]>
onToolSettingsChange(args
: { handler
: (settings
: ) => void
; }): VoidFunction
{ handler
: (settings
: ) => void
; }
(settings
: ) => void