huweili-cesium 1.2.26 → 1.2.28
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.
- package/js/basis.js +7 -6
- package/package.json +1 -1
package/js/basis.js
CHANGED
|
@@ -121,8 +121,14 @@ export function basicConfig() {
|
|
|
121
121
|
* @param map - 地图实例
|
|
122
122
|
*/
|
|
123
123
|
const mouseController = (map, _mapId, callbacks = {}) => {
|
|
124
|
+
// 阻止浏览器默认的右键菜单弹出
|
|
125
|
+
map.scene.canvas.addEventListener('contextmenu', (e) => {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
});
|
|
128
|
+
|
|
124
129
|
// 添加右键点击事件监听
|
|
125
130
|
map.screenSpaceEventHandler.setInputAction((click) => {
|
|
131
|
+
console.log('右键点击事件触发')
|
|
126
132
|
// 获取点击位置的笛卡尔坐标
|
|
127
133
|
const cartesian = map.camera.pickEllipsoid(click.position, map.scene.globe.ellipsoid);
|
|
128
134
|
|
|
@@ -142,10 +148,6 @@ export function basicConfig() {
|
|
|
142
148
|
};
|
|
143
149
|
|
|
144
150
|
console.log('点击位置:', position);
|
|
145
|
-
callbacks.onRightClick?.(position);
|
|
146
|
-
|
|
147
|
-
// 弹出alert显示坐标信息
|
|
148
|
-
// alert(`点击位置坐标:\n经度:${Number(lng).toFixed(6)}\n纬度:${Number(lat).toFixed(6)}\n高度:${Number(height).toFixed(2)}米`);
|
|
149
151
|
}
|
|
150
152
|
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
151
153
|
|
|
@@ -172,8 +174,7 @@ export function basicConfig() {
|
|
|
172
174
|
lat: Number(lat),
|
|
173
175
|
height: Number(height)
|
|
174
176
|
});
|
|
175
|
-
|
|
176
|
-
// alert(`点击位置坐标:\n经度:${Number(lng).toFixed(6)}\n纬度:${Number(lat).toFixed(6)}\n高度:${Number(height).toFixed(2)}米`);
|
|
177
|
+
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|