Class: PopupComponent
component.PopupComponent
classdesc Component for showing HTML popup objects.
The add method is used for adding new popups. Popups are removed by reference.
It is not possible to update popups in the set by updating any properties directly on the popup object. Popups need to be replaced by removing them and creating new ones with relevant changed properties and adding those instead.
Popups are only relevant to a single image because they are based on 2D basic image coordinates. Popups related to a certain image should be removed when the viewer is moved to another image.
To retrive and use the popup component
example
var viewer = new Viewer({ component: { popup: true }, ... });
var popupComponent = viewer.getComponent("popup");Hierarchy#
Component<ComponentConfiguration>↳
PopupComponent
Properties#
componentName#
â–ª Static componentName: ComponentName = "popup"
Overrides#
Defined in#
component/popup/PopupComponent.ts:54
Accessors#
activated#
• get activated(): boolean
Get activated.
Returns#
boolean
Value indicating if the component is currently active.
Defined in#
defaultConfiguration#
• get defaultConfiguration(): TConfiguration
Get default configuration.
Returns#
TConfiguration
Default configuration for component.
Defined in#
name#
• get name(): string
Get name.
description The name of the component. Used when interacting with the
component through the Viewer's API.
Returns#
string
Defined in#
Methods#
add#
â–¸ add(popups): void
Add popups to the popups set.
description Adding a new popup never replaces an old one
because they are stored by reference. Adding an already
existing popup has no effect.
example
popupComponent.add([popup1, popup2]);Parameters#
| Name | Type | Description |
|---|---|---|
popups | Popup[] | Popups to add. |
Returns#
void
Defined in#
component/popup/PopupComponent.ts:94
configure#
â–¸ configure(configuration): void
Configure the component.
Parameters#
| Name | Type | Description |
|---|---|---|
configuration | ComponentConfiguration | Component configuration. |
Returns#
void
Inherited from#
Defined in#
fire#
â–¸ fire<T>(type, event): void
Type parameters#
| Name |
|---|
T |
Parameters#
| Name | Type |
|---|---|
type | ComponentEventType |
event | T |
Returns#
void
Inherited from#
Defined in#
getAll#
â–¸ getAll(): Popup[]
Returns an array of all popups.
example
var popups = popupComponent.getAll();Returns#
Popup[]
Defined in#
component/popup/PopupComponent.ts:119
off#
â–¸ off<T>(type, handler): void
Unsubscribe from an event by its name.
Type parameters#
| Name |
|---|
T |
Parameters#
| Name | Type | Description |
|---|---|---|
type | ComponentEventType | The name of the event to unsubscribe from. |
handler | (event: T) => void | The handler to remove. |
Returns#
void
Inherited from#
Defined in#
on#
â–¸ on<T>(type, handler): void
Subscribe to an event by its name.
Type parameters#
| Name |
|---|
T |
Parameters#
| Name | Type | Description |
|---|---|---|
type | ComponentEventType | The name of the event to subscribe to. |
handler | (event: T) => void | The handler called when the event occurs. |
Returns#
void
Inherited from#
Defined in#
remove#
â–¸ remove(popups): void
Remove popups based on reference from the popup set.
example
popupComponent.remove([popup1, popup2]);Parameters#
| Name | Type | Description |
|---|---|---|
popups | Popup[] | Popups to remove. |
Returns#
void
Defined in#
component/popup/PopupComponent.ts:133
removeAll#
â–¸ removeAll(): void
Remove all popups from the popup set.
example
popupComponent.removeAll();Returns#
void