class

ToolManager

Tool lifecycle manager. Creates an overlay div for event interception, manages tool activation/deactivation, undo/redo command system.

Constructor

new ToolManager(options?: ToolManagerOptions)
Parameter Type Description
options ToolManagerOptions optional Configuration

ToolManagerOptions

Field Type Description
previewLayer IPreviewLayer optional Layer for drawing previews
maxHistorySize number optional Undo history limit Default: 50
wheelPassthrough boolean optional Pass wheel events to map Default: true

Properties

Name Type Access Description
activeTool ITool | null readonly Currently active tool
tools ReadonlyMap<string, ITool> readonly All registered tools

Methods

init()

init(refs: { canvas, container, toMap, toScreen, getMode, getZoom, markDirty }): void

Initialize with view references. Called automatically by MapView.

Returns void

registerTool()

registerTool(tool: ITool): void

Register a tool.

Returns void

unregisterTool()

unregisterTool(id: string): void

Remove a tool.

Returns void

activateTool()

activateTool(id: string): void

Activate a tool by ID.

Returns void

deactivateTool()

deactivateTool(): void

Deactivate the current tool.

Returns void

undo()

undo(): void

Undo last command.

Returns void

redo()

redo(): void

Redo last undone command.

Returns void

destroy()

destroy(): void

Cleanup overlay and event listeners.

Returns void