Skip to content

editor › Globals › ToolLibrary

Class: ToolLibrary

The tool library collects all tools and allows to get instances by name etc

Hierarchy

  • ToolLibrary

Index

Properties

Methods

Properties

Private lastUserSelectedToolName

• lastUserSelectedToolName: string = null

Defined in src/tools/ToolLibrary.ts:67

a reference to name and parameters of the last user selected tool


Private lastUserSelectedToolParameters

• lastUserSelectedToolParameters: any = null

Defined in src/tools/ToolLibrary.ts:68


Private selectedToolName

• selectedToolName: string

Defined in src/tools/ToolLibrary.ts:61

if there is no UI binding, the currently selected tool is stored here as a string


Private selectedToolParameters

• selectedToolParameters: any

Defined in src/tools/ToolLibrary.ts:62


Private state

• state: ParametricEnumState = null

Defined in src/tools/ToolLibrary.ts:56

optional: UI binding to the currently selected tool


Private toolLibrary

• toolLibrary: Map‹string, IToolManifestation› = new Map()

Defined in src/tools/ToolLibrary.ts:48

The actual collection of tool classes


Private Readonly toolSelectedEventEmitter

• toolSelectedEventEmitter: EventEmitter‹IToolSelectionEvent› = new EventEmitter()

Defined in src/tools/ToolLibrary.ts:50


Private Readonly toolUserDeselectedEventEmitter

• toolUserDeselectedEventEmitter: EventEmitter‹IToolSelectionEvent› = new EventEmitter()

Defined in src/tools/ToolLibrary.ts:51

Methods

Private _combineAllToolManifestations

▸ _combineAllToolManifestations(toolClasses: ToolSubclass[], toolManifestations: IToolManifestation[]): Map‹string, IToolManifestation›

Defined in src/tools/ToolLibrary.ts:324

Get the UI manifestations of each tool and append them to the library

Parameters:

Name Type
toolClasses ToolSubclass[]
toolManifestations IToolManifestation[]

Returns: Map‹string, IToolManifestation›

an object with all tool manifestations


Private _onStateChange

▸ _onStateChange(event: IMenuStateChange): void

Defined in src/tools/ToolLibrary.ts:306

Parameters:

Name Type
event IMenuStateChange

Returns: void


Private _onUserStateChange

▸ _onUserStateChange(event: IMenuStateChange): void

Defined in src/tools/ToolLibrary.ts:291

Parameters:

Name Type
event IMenuStateChange

Returns: void


Private _setDefaultValues

▸ _setDefaultValues(uiManifestation: IToolManifestation): void

Defined in src/tools/ToolLibrary.ts:366

Parameters:

Name Type
uiManifestation IToolManifestation

Returns: void


bindState

▸ bindState(state: ParametricEnumState): void

Defined in src/tools/ToolLibrary.ts:139

Binds the state of this ToolLibrary to the supplied EnumState

Parameters:

Name Type Description
state ParametricEnumState -

Returns: void


canWorkWithHints

▸ canWorkWithHints(internalToolName: string): boolean

Defined in src/tools/ToolLibrary.ts:266

Parameters:

Name Type
internalToolName string

Returns: boolean


getBoundState

▸ getBoundState(): ParametricEnumState‹›

Defined in src/tools/ToolLibrary.ts:161

@ return [ParametricEnumState] the tool selection state bound to the tool library

Returns: ParametricEnumState‹›


getSelectedTool

▸ getSelectedTool(): object

Defined in src/tools/ToolLibrary.ts:77

Returns: object

{name, parameters} the currently selected tool"s name and parameters

  • name: any = this.getSelectedToolName()

  • parameters: any = this.getSelectedToolParameters()


getSelectedToolName

▸ getSelectedToolName(): any

Defined in src/tools/ToolLibrary.ts:87

Returns: any

the currently selected tool's name


getSelectedToolParameters

▸ getSelectedToolParameters(): any

Defined in src/tools/ToolLibrary.ts:98

Returns: any

the currently selected tool's parameters


getToolClass

▸ getToolClass(internalToolName: string): ToolSubclass

Defined in src/tools/ToolLibrary.ts:242

Parameters:

Name Type
internalToolName string

Returns: ToolSubclass


getToolInstance

▸ getToolInstance(internalToolName: string, options: IToolOptions): Tool‹›

Defined in src/tools/ToolLibrary.ts:254

Returns a newly generated instance of the specified tool

Parameters:

Name Type Description
internalToolName string the name of the tool to be instantiated
options IToolOptions -

Returns: Tool‹›


getToolManifestation

▸ getToolManifestation(internalName: string): IToolManifestation

Defined in src/tools/ToolLibrary.ts:287

Parameters:

Name Type
internalName string

Returns: IToolManifestation


getToolSelectedEventEmitter

▸ getToolSelectedEventEmitter(): IPublicEventEmitterInterface‹IToolSelectionEvent›

Defined in src/tools/ToolLibrary.ts:117

Returns: IPublicEventEmitterInterface‹IToolSelectionEvent›


getToolUserDeselectedEventEmitter

▸ getToolUserDeselectedEventEmitter(): IPublicEventEmitterInterface‹IToolSelectionEvent›

Defined in src/tools/ToolLibrary.ts:121

Returns: IPublicEventEmitterInterface‹IToolSelectionEvent›


initializeTools

▸ initializeTools(toolClasses: ToolSubclass[], toolManifestations: IToolManifestation[]): void

Defined in src/tools/ToolLibrary.ts:131

Initializes the tool library with the specified tool classes, queries their UI manifestation.

Parameters:

Name Type Description
toolClasses ToolSubclass[] tools to load
toolManifestations IToolManifestation[] tool manifestation configs, see templateModule for details

Returns: void


isSelectedToolPersistent

▸ isSelectedToolPersistent(): boolean

Defined in src/tools/ToolLibrary.ts:109

Returns: boolean

whether the currently selected tool is selected persistently (@see MenuItem)


isToolSelected

▸ isToolSelected(): boolean

Defined in src/tools/ToolLibrary.ts:70

Returns: boolean


isValidToolName

▸ isValidToolName(internalToolName: string): boolean

Defined in src/tools/ToolLibrary.ts:283

Returns true or false if the given string is a valid internal tool name

Parameters:

Name Type
internalToolName string

Returns: boolean


listTools

▸ listTools(): any[]

Defined in src/tools/ToolLibrary.ts:168

@ return [Array] list of tool names stored in the library

Returns: any[]


requiresContinuousModelIntersection

▸ requiresContinuousModelIntersection(internalToolName: string): boolean

Defined in src/tools/ToolLibrary.ts:273

Parameters:

Name Type
internalToolName string

Returns: boolean


resetSelectedTool

▸ resetSelectedTool(userInitiated: boolean): void

Defined in src/tools/ToolLibrary.ts:190

Sets the selected tool to the default value (Config.get "interaction.defaultTool").

Parameters:

Name Type Default Description
userInitiated boolean false Set to true in order to indicate, that a user action caused the tool selection to be reset

Returns: void


resetSelectedToolIfNecessary

▸ resetSelectedToolIfNecessary(): void

Defined in src/tools/ToolLibrary.ts:178

Call resetSelectedTool after finishing a tool interaction if the tool is not selected stickily and the state is not marked persistent (in that case, only user interaction can change the tool)

Returns: void


setSelectedToolName

▸ setSelectedToolName(selectedToolName: string, persistence: boolean, parameters: any): void

Defined in src/tools/ToolLibrary.ts:220

Sets the currently selected tool (from editor code side) and updates the UI, if a GroupSelectionListener is bound

Parameters:

Name Type Default Description
selectedToolName string - Internal name of the tool to be selected
persistence boolean false Flag whether the selection/state should be persistent
parameters any null (optional) Parameters supplied to this tool (usually defined by the menu item)

Returns: void


worksInEmptySpace

▸ worksInEmptySpace(internalToolName: string): boolean

Defined in src/tools/ToolLibrary.ts:259

Parameters:

Name Type
internalToolName string

Returns: boolean