Package Exports
- @cesium-extends/popup
- @cesium-extends/popup/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@cesium-extends/popup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@cesium-extends/popup
A lightweight and easy-to-use popup component for CesiumJS. 中文 Readme
Installation
To install @cesium-extends/popup, run:
npm install @cesium-extends/popupUsage
Here's an example of how to use @cesium-extends/popup:
import Popup from "@cesium-extends/popup";
import { Viewer } from "cesium";
const viewer = new Viewer("cesiumContainer");
const options = {
position: [120, 30, 0],
element: document.getElementById("popup"),
offset: [10, 10],
};
const popup = new Popup(viewer, options);
// Update the popup's position
popup.position = [121, 31, 0];
// Destroy the popup
popup.destroy();PopupOptions
The PopupOptions interface has the following properties:
position: The position of the popup, specified as an array of[longitude, latitude, height]. Ifnull, the popup will be hidden.element: The HTML element that represents the popup.offset(optional): An array of[xOffset, yOffset]that specifies the offset of the popup from its position.
Properties
position: Gets or sets the position of the popup.destroyed: Indicates whether the popup has been destroyed.
Methods
switchElementShow(val: boolean): Shows or hides the popup.setPosition(): Updates the position of the popup.destroy(): Destroys the popup, removing any event listeners and cleaning up resources.