Class: ModeExtensionBase<T>
Class: ModeExtensionBase<T>
Base class for any mode extension for RenderManager. Mode extensions can store and restore scene state. In other words define additional mode for viewer for scene representation. For example, mode extension can colorize any elements in scene and store this scene state.
Type parameters
Name |
---|
T |
Hierarchy
↳
ModeExtensionBase
Constructors
constructor
• new ModeExtensionBase<T
>(viewerName
, modeDesc
, modeIcon
): ModeExtensionBase
<T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
viewerName | string | Owner viewer name. |
modeDesc | string | Mode description or name. |
modeIcon | string | Mode icon name. Icon name will be used by viewer Toolbar UI component for displaying mode buttons. |
Returns
Overrides
Properties
enableTooltip
• enableTooltip: boolean
Enable or disable viewer tooltip feature for this extension.
getName
• getName: () => string
Get unique extension name.
Type declaration
▸ (): string
Get unique extension name.
Returns
string
Inherited from
helpDesc
• Readonly
helpDesc: string
Optional description for placing on HelpToolbar.
Inherited from
helpIcon
• Readonly
helpIcon: string
Optional icon for placing on HelpToolbar.
Inherited from
hideToolbar
• hideToolbar: boolean
Is extension need to hide toolbar or not.
Inherited from
modeDesc
• Readonly
modeDesc: string
Mode description or name.
modeIcon
• Readonly
modeIcon: string
Mode icon name. Icon name will be used by viewer Toolbar UI component for displaying mode buttons.
showTooltip
• showTooltip: boolean
Show or hide viewer tooltip feature if enableTooltip == true.
state
• state: any
Any extension data which can be stored in browser local storage and restored after (any extension settings, buttons state and so one). State will be saved in local storage with 'tangl-ext-extensionName' key.
Inherited from
type
• Readonly
type: string
Extension type (ext, mode, control).
Overrides
viewerName
• Readonly
viewerName: string
Owner viewer name.
Inherited from
getName
▪ Static
getName: () => string
Get unique extension name.
Type declaration
▸ (): string
Get unique extension name.
Returns
string
Inherited from
Methods
clearData
▸ clearData(): void
Clear resource array, details array and elements list.
Returns
void
getRenderManager
▸ getRenderManager(): RenderManager
Get current RenderManager instance.
Returns
Inherited from
ExtensionBase.getRenderManager
modeIconRender
▸ modeIconRender(container
): void
Render function for rendering icon content for Toolbar component.
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Parent DOM container. |
Returns
void
restoreState
▸ restoreState(): void
Restore extension state from the local storage.
Returns
void
Inherited from
restoreTooltipState
▸ restoreTooltipState(): void
Restore enableTooltip state from local storage.
Returns
void
saveState
▸ saveState(): void
Save extension state in the local storage.
Returns
void
Inherited from
saveTooltipState
▸ saveTooltipState(): void
Save enableTooltip state to local storage.
Returns
void
setData
▸ setData(elNums
, resourceArray
, details
, forceClearData?
): void
Set data to resource array and details array for elements list.
Parameters
Name | Type | Description |
---|---|---|
elNums | number [] | Elements self Ids. |
resourceArray | T [] | Resource data array. |
details | any | Details data array. |
forceClearData? | boolean | force clear data after applying by extension. |
Returns
void
setRestoreStateHandler
▸ setRestoreStateHandler(handler
): this
Sets external hook handler for restoring extension state in the local storage.
Parameters
Name | Type | Description |
---|---|---|
handler | Function | handler hook function. |
Returns
this
Inherited from
ExtensionBase.setRestoreStateHandler
setRestoreTooltipStateHandler
▸ setRestoreTooltipStateHandler(handler
): this
Sets external hook handler for restoring extension tooltip state in the local storage.
Parameters
Name | Type | Description |
---|---|---|
handler | Function | handler hook function. |
Returns
this
setSaveStateHandler
▸ setSaveStateHandler(handler
): this
Sets external hook handler for storing extension state in the local storage.
Parameters
Name | Type | Description |
---|---|---|
handler | Function | handler hook function. |
Returns
this
Inherited from
ExtensionBase.setSaveStateHandler
setSaveTooltipStateHandler
▸ setSaveTooltipStateHandler(handler
): this
Sets external hook handler for storing extension tooltip state in the local storage.
Parameters
Name | Type | Description |
---|---|---|
handler | Function | handler hook function. |
Returns
this
setup
▸ setup(): void
Setup viewer state and modify elements by this state. Should be overridden by each mode extension.
Returns
void
tooltipRender
▸ tooltipRender(container
): void
Render function for rendering tooltip content when enableTooltip == true.
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Parent DOM container. |
Returns
void
Hooks
added
▸ added(): void
Hook when extension is added to ExtensionManager. Called by ExtensionManager.addExtension().
Returns
void
Inherited from
commandChanged
▸ commandChanged(newCommand
): void
Hook when current extension command is changed or finished. Called by ExtensionManager.setCurrentCommandExtension().
Parameters
Name | Type |
---|---|
newCommand | ExtensionBase |
Returns
void
Inherited from
dedicatedToolbarRender
▸ dedicatedToolbarRender(container
): void
Render function for rendering dedicated toolbar content.
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Parent DOM container. |
Returns
void
Inherited from
ExtensionBase.dedicatedToolbarRender
deleted
▸ deleted(): void
Hook when extension is deleted from ExtensionManager. Called by ExtensionManager.clear().
Returns
void
Inherited from
selected
▸ selected(): void
Hook when extension is activated (selected as current mode). Called by ExtensionManager.selectControllerExtension().
Returns
void
sharedToolbarRender
▸ sharedToolbarRender(container
): void
Render function for rendering shared toolbar content.
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Parent DOM container. |
Returns
void
Inherited from
ExtensionBase.sharedToolbarRender
uiRender
▸ uiRender(container
): void
Render function for rendering additional UI above viewer canvas.
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Parent DOM container. |
Returns
void
Inherited from
unselected
▸ unselected(): void
Hook when extension is deactivated. Called by ExtensionManager.selectControllerExtension()
Returns
void