import { THREE, THREEAddons, BaseViewer, Plugin } from "@x-viewer/core";
export interface Hotpoint {
hotpointId: string;
anchorPosition: number[];
visible?: boolean;
html: string;
}
/**
* Hotpoint plugin manages hotpoints in a viewer.
* It can be used by Viewer2d and Viewer3d.
* - A hotpoint is created and stored by user. User define its html and css.
* - A hotpoint can be added to, and removed from viewer.
* - Caller should set a hotpointId that is unique in the session of current viewer.
* - Viewer2d doesn't maintain the relationship between hotpoint and layout.
*/
export declare class HotpointPlugin extends Plugin {
protected hotpointRoot?: THREE.Group;
protected css2dRenderer: THREEAddons.CSS2DRenderer;
constructor(viewer: BaseViewer);
/**
* Adds a CSS2D hotpoint. `hotpointId` must be unique for this viewer session.
* @param hotpoint Hotpoint payload (HTML, anchor, visibility).
* @example
* ``` typescript
* const hotpoint = {
* hotpointId: "c6ea70a3-ddb0-4dd0-87c8-bd2491936428",
* anchorPosition: [0, 0, 0],
* html: "
hotpoint
",
* visible: true,
* };
* const plugin = new HotpointPlugin(viewer);
* plugin.add(hotpoint);
* ```
*/
add(hotpoint: Hotpoint): void;
/**
* Removes the hotpoint with the given id.
* @param hotpointId Hotpoint id to remove.
* @example
* ``` typescript
* const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
* const plugin = new HotpointPlugin(viewer);
* plugin.remove(hotpointId);
* ```
*/
remove(hotpointId: string): void;
/**
* Removes every hotpoint from the scene.
* @example
* ``` typescript
* const plugin = new HotpointPlugin(viewer);
* plugin.clear();
* ```
*/
clear(): void;
/**
* Checks if hotpoint with specific id already exist
* Caller should set a hotpointId that is unique in the session of current Viewer2d.
* @hidden
*/
has(hotpointId: string): boolean;
/**
* Updates world position of an existing hotpoint.
* @example
* ``` typescript
* const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
* const plugin = new HotpointPlugin(viewer);
* plugin.move(hotpointId, [10, 10, 0]);
* ```
*/
move(hotpointId: string, position: THREE.Vector2 | THREE.Vector3): void;
/**
* Shows or hides a hotpoint without removing it.
* @example
* ``` typescript
* const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
* const plugin = new HotpointPlugin(viewer);
* plugin.setVisible(hotpointId, false);
* ```
*/
setVisible(hotpointId: string, visible: boolean): void;
protected findHotpointObject(hotpointId: string): THREEAddons.CSS2DObject | undefined;
/**
*
* @param hotpointId
* @returns
* @description Fly to hotpoint by hotpointId.
*/
flyToHotpoint(hotpointId: string): void;
destroy(): void;
protected onAfterRender: () => void;
}