huweili-cesium 1.2.28 → 1.2.30
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 +17 -9
- package/package.json +1 -1
package/js/basis.js
CHANGED
|
@@ -128,10 +128,8 @@ export function basicConfig() {
|
|
|
128
128
|
|
|
129
129
|
// 添加右键点击事件监听
|
|
130
130
|
map.screenSpaceEventHandler.setInputAction((click) => {
|
|
131
|
-
console.log('右键点击事件触发')
|
|
132
131
|
// 获取点击位置的笛卡尔坐标
|
|
133
132
|
const cartesian = map.camera.pickEllipsoid(click.position, map.scene.globe.ellipsoid);
|
|
134
|
-
|
|
135
133
|
if (cartesian) {
|
|
136
134
|
// 转换为经纬度
|
|
137
135
|
const cartographic = Cesium.Cartographic.fromCartesian(cartesian);
|
|
@@ -147,16 +145,20 @@ export function basicConfig() {
|
|
|
147
145
|
cartesian,
|
|
148
146
|
};
|
|
149
147
|
|
|
150
|
-
console.log('
|
|
148
|
+
console.log('右键点击事件触发,点击位置:', position);
|
|
149
|
+
callbacks.onRightClick?.(position);
|
|
150
|
+
} else {
|
|
151
|
+
callbacks.onRightClick?.({
|
|
152
|
+
mapId: _mapId,
|
|
153
|
+
screenPosition: click.position,
|
|
154
|
+
});
|
|
151
155
|
}
|
|
152
156
|
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
153
157
|
|
|
154
158
|
// 添加左键点击事件,用于隐藏弹窗
|
|
155
159
|
map.screenSpaceEventHandler.setInputAction((click) => {
|
|
156
|
-
console.log('左键点击事件触发')
|
|
157
160
|
// 获取点击位置的笛卡尔坐标
|
|
158
161
|
const cartesian = map.camera.pickEllipsoid(click.position, map.scene.globe.ellipsoid);
|
|
159
|
-
|
|
160
162
|
if (cartesian) {
|
|
161
163
|
// 转换为经纬度
|
|
162
164
|
const cartographic = Cesium.Cartographic.fromCartesian(cartesian);
|
|
@@ -164,7 +166,7 @@ export function basicConfig() {
|
|
|
164
166
|
const lat = Cesium.Math.toDegrees(cartographic.latitude);
|
|
165
167
|
const height = cartographic.height;
|
|
166
168
|
|
|
167
|
-
console.log('
|
|
169
|
+
console.log('左键点击事件触发,点击位置:', {
|
|
168
170
|
lng: Number(lng),
|
|
169
171
|
lat: Number(lat),
|
|
170
172
|
height: Number(height)
|
|
@@ -172,11 +174,17 @@ export function basicConfig() {
|
|
|
172
174
|
callbacks.onLeftClick?.({
|
|
173
175
|
lng: Number(lng),
|
|
174
176
|
lat: Number(lat),
|
|
175
|
-
height: Number(height)
|
|
177
|
+
height: Number(height),
|
|
178
|
+
mapId: _mapId,
|
|
179
|
+
screenPosition: click.position,
|
|
180
|
+
cartesian,
|
|
181
|
+
});
|
|
182
|
+
} else {
|
|
183
|
+
callbacks.onLeftClick?.({
|
|
184
|
+
mapId: _mapId,
|
|
185
|
+
screenPosition: click.position,
|
|
176
186
|
});
|
|
177
|
-
|
|
178
187
|
}
|
|
179
|
-
|
|
180
188
|
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
181
189
|
}
|
|
182
190
|
|