huweili-cesium 1.2.16 → 1.2.17
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/measureDistance.js +10 -6
- package/package.json +1 -1
package/js/measureDistance.js
CHANGED
|
@@ -253,17 +253,20 @@ export function measureDistance() {
|
|
|
253
253
|
if (deleteButtonEntity || !endPosition) return
|
|
254
254
|
deleteButtonEntity = map.entities.add({
|
|
255
255
|
id: tempIds.deleteButton,
|
|
256
|
-
position: endPosition,
|
|
256
|
+
position: new Cesium.CallbackProperty(() => endPosition, false),
|
|
257
257
|
label: {
|
|
258
258
|
text: '删除',
|
|
259
|
-
font: '
|
|
259
|
+
font: '700 13px Microsoft YaHei',
|
|
260
|
+
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
260
261
|
fillColor: Cesium.Color.WHITE,
|
|
262
|
+
outlineColor: Cesium.Color.fromCssColorString('#b71c1c'),
|
|
263
|
+
outlineWidth: 4,
|
|
261
264
|
showBackground: true,
|
|
262
|
-
backgroundColor: Cesium.Color.fromCssColorString('rgba(
|
|
263
|
-
backgroundPadding: new Cesium.Cartesian2(
|
|
265
|
+
backgroundColor: Cesium.Color.fromCssColorString('rgba(244, 67, 54, 0.96)'),
|
|
266
|
+
backgroundPadding: new Cesium.Cartesian2(12, 7),
|
|
264
267
|
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
265
268
|
horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
|
|
266
|
-
pixelOffset: new Cesium.Cartesian2(
|
|
269
|
+
pixelOffset: new Cesium.Cartesian2(16, -34),
|
|
267
270
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
268
271
|
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, Number.POSITIVE_INFINITY)
|
|
269
272
|
}
|
|
@@ -376,7 +379,8 @@ export function measureDistance() {
|
|
|
376
379
|
deleteHandler = new Cesium.ScreenSpaceEventHandler(map.scene.canvas)
|
|
377
380
|
deleteHandler.setInputAction((movement) => {
|
|
378
381
|
const picked = map.scene.pick(movement.position)
|
|
379
|
-
|
|
382
|
+
const pickedEntity = picked?.id
|
|
383
|
+
if (!Cesium.defined(pickedEntity) || pickedEntity !== deleteButtonEntity) return
|
|
380
384
|
destroyGraphic()
|
|
381
385
|
if (typeof options.onDelete === 'function') options.onDelete(options.id)
|
|
382
386
|
}, Cesium.ScreenSpaceEventType.LEFT_CLICK)
|