npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cesium-popup-ts

v1.0.5

Published

基于cesium开发的一个自定义弹窗类。传入HTML元素和坐标点position即可使用。弹窗位置跟随坐标点实时更新。可以自定义弹窗相对坐标点的位置、偏移量等,可以配置弹窗自适应,尽量让弹窗显示在cesium容器内。

Downloads

5

Readme

cesium-popup-ts

介绍

基于 cesium 开发的一个自定义弹窗类。传入 HTML 元素和坐标点 position 即可使用。弹窗位置跟随坐标点实时更新。可以自定义弹窗相对坐标点的位置、偏移量等,可以配置弹窗自适应,尽量让弹窗显示在 cesium 容器内。

安装教程

  1. npm i cesium-popup-ts

使用说明

配置项 options 说明

| 选项 | 类型 | 默认值 | 描述 | 备注 | | ------------------ | ---------------------------------------------- | ----------------------- | ------------------------------------------------- | --------------------------------------------------------------- | | dom | HTMLElement | 无 | 弹窗的 DOM 元素,必须提供此元素来作为弹窗的内容。 | 必选项 | | viewer | Cesium.Viewer | 无 | Cesium 的 Viewer 实例,用于关联 Cesium 场景。 | 必选项 | | 置。 | 必选项 | | isAdaptive | boolean | false | 是否自适应弹窗大小。 | 可选项,设置为 true 时,弹窗自动调整大小以适应内容。 | | offsetLeft | number | 0 | 弹窗相对于指定位置的水平偏移量,单位为像素。 | 可选项 | | offsetTop | number | 0 | 弹窗相对于指定位置的垂直偏移量,单位为像素。 | 可选项 | | verticalOrigin | VerticalOrigin (TOP, CENTER, BOTTOM) | VerticalOrigin.TOP | 弹窗相对于位置的垂直对齐方式。 | 可选项,可选值包括 VerticalOrigin.TOP, CENTER, BOTTOM。 | | horizontalOrigin | HorizontalOrigin (LEFT, CENTER, RIGHT) | HorizontalOrigin.LEFT | 弹窗相对于位置的水平对齐方式。 | 可选项,可选值包括 HorizontalOrigin.LEFT, CENTER, RIGHT。 |

使用示例

  • ES 模块
import { CesiumPopup } from "cesium-popup-ts";
const popup = new CesiumPopup({
  dom: document.getElementById("popup"),
  viewer: cesiumViewer,
  isAdaptive: true,
  offsetLeft: 10,
  offsetTop: 20,
  verticalOrigin: CesiumPopup.VerticalOrigin.BOTTOM,
  horizontalOrigin: CesiumPopup.HorizontalOrigin.RIGHT,
});
popup.bindTo(new Cesium.Cartesian3(12, 34, 56789));
  • UMD 模块
<script src="https://cesium.com/downloads/cesiumjs/releases/1.95/Build/Cesium/Cesium.js"></script>
<link
  href="https://cesium.com/downloads/cesiumjs/releases/1.95/Build/Cesium/Widgets/widgets.css"
  rel="stylesheet"
/>
<script src="../dist/index.umd.cjs"></script>
<script type="module">
  const popup = new CesiumPopup({
    dom: document.getElementById("popup"),
    viewer: cesiumViewer,
    isAdaptive: true,
    offsetLeft: 10,
    offsetTop: 20,
    verticalOrigin: CesiumPopup.VerticalOrigin.BOTTOM,
    horizontalOrigin: CesiumPopup.HorizontalOrigin.RIGHT,
  });
  popup.bindTo(new Cesium.Cartesian3(12, 34, 56789));
</script>

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request