Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
cesium-popup
Advanced tools
npm i cesium-popup
在 main.js 或者 main.ts 中导入样式
// 根据安装后的相对路径为准,这里只是演示
import "/src/Popup.css";
基本使用
// 注意需要在使用的组件中,导入Cesium变量,Popup中会使用一些静态方法
import * as Cesium from "cesium";
// 气泡
const popup = new Popup({
// 气泡背景色
bgColor: "white",
// 气泡定位,如果不写自适应,有"bottom","top","left","right"四种定位
anchor: "bottom",
// 气泡添加的类名,可以自定义样式
className: "popup-test",
// 是否显示关闭按钮
closeButton: true,
// 气泡的偏移值,offset[0]为横向偏移值,offset[1]为纵向偏移值
offset: [0, 0],
});
// 地图
const map = new Cesium.Viewer("mapContainer");
// 设置HTML
popup.setHTML("<div>hello,world</div>").setLngLat([lng, lat]).addTo(map);
// 或者设置dom元素
const el = document.getElementById("test");
popup.setDOMContent(el).setLngLat([lng, lat]).addTo(map);
事件监听
// 气泡
const popup = new Popup();
// 气泡打开事件
popup.on("open", () => {
console.log("do something");
});
// 气泡关闭事件
popup.on("close", () => {
console.log("do something");
});
更多参数设置请看 './demo/index.html' 演示
FAQs
cesium气泡
The npm package cesium-popup receives a total of 1 weekly downloads. As such, cesium-popup popularity was classified as not popular.
We found that cesium-popup demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.