huweili-cesium 1.2.24 → 1.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/js/basis.js +17 -1
  2. package/package.json +1 -1
package/js/basis.js CHANGED
@@ -152,7 +152,23 @@ export function basicConfig() {
152
152
  // 添加左键点击事件,用于隐藏弹窗
153
153
  map.screenSpaceEventHandler.setInputAction((click) => {
154
154
  console.log('左键点击事件触发')
155
- callbacks.onLeftClick?.({ mapId: _mapId, screenPosition: click.position });
155
+ const cartesian = map.camera.pickEllipsoid(click.position, map.scene.globe.ellipsoid);
156
+ if (cartesian) {
157
+ const cartographic = Cesium.Cartographic.fromCartesian(cartesian);
158
+ const lng = Cesium.Math.toDegrees(cartographic.longitude);
159
+ const lat = Cesium.Math.toDegrees(cartographic.latitude);
160
+ const height = cartographic.height;
161
+ callbacks.onLeftClick?.({
162
+ mapId: _mapId,
163
+ screenPosition: click.position,
164
+ lng: Number(lng),
165
+ lat: Number(lat),
166
+ height: Number(height),
167
+ cartesian,
168
+ });
169
+ } else {
170
+ callbacks.onLeftClick?.({ mapId: _mapId, screenPosition: click.position });
171
+ }
156
172
  }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
157
173
  }
158
174
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huweili-cesium",
3
- "version": "1.2.24",
3
+ "version": "1.2.25",
4
4
  "description": "基于 Cesium 的地图工具库(无人机态势、轨迹、围栏、工具栏等)",
5
5
  "type": "module",
6
6
  "main": "./index.js",