Class: ExtensionBase
Class: ExtensionBase
Base class for any extension for render manager.
Hierarchy
EventTarget
↳
ExtensionBase
Constructors
constructor
• new ExtensionBase(viewerName
, helpDesc?
, helpIcon?
): ExtensionBase
Parameters
Name | Type | Description |
---|---|---|
viewerName | string | Owner viewer name. |
helpDesc? | string | Optional description for help button. |
helpIcon? | string | Optional icon for help button. |
Returns
Overrides
EventTarget.constructor
Properties
getName
• getName: () => string
Get unique extension name.
Type declaration
▸ (): string
Get unique extension name.
Returns
string
helpDesc
• Readonly
helpDesc: string
Optional description for placing on HelpToolbar.
helpIcon
• Readonly
helpIcon: string
Optional icon for placing on HelpToolbar.
hideToolbar
• hideToolbar: boolean
Is extension need to hide toolbar or not.
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.
type
• Readonly
type: string
Extension type (ext, mode, control).
viewerName
• Readonly
viewerName: string
Owner viewer name.
getName
▪ Static
getName: () => string
Get unique extension name.
Type declaration
▸ (): string
Get unique extension name.
Returns
string
Methods
getRenderManager
▸ getRenderManager(): RenderManager
Get current RenderManager instance.
Returns
restoreState
▸ restoreState(): void
Restore extension state from the local storage.
Returns
void
saveState
▸ saveState(): void
Save extension state in the local storage.
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
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
Hooks
added
▸ added(): void
Hook when extension is added to ExtensionManager. Called by ExtensionManager.addExtension().
Returns
void
commandChanged
▸ commandChanged(newCommand
): void
Hook when current extension command is changed or finished. Called by ExtensionManager.setCurrentCommandExtension().
Parameters
Name | Type |
---|---|
newCommand | ExtensionBase |
Returns
void
dedicatedToolbarRender
▸ dedicatedToolbarRender(container
): void
Render function for rendering dedicated toolbar content.
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Parent DOM container. |
Returns
void
deleted
▸ deleted(): void
Hook when extension is deleted from ExtensionManager. Called by ExtensionManager.clear().
Returns
void
sharedToolbarRender
▸ sharedToolbarRender(container
): void
Render function for rendering shared toolbar content.
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Parent DOM container. |
Returns
void
uiRender
▸ uiRender(container
): void
Render function for rendering additional UI above viewer canvas.
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Parent DOM container. |
Returns
void