mirror of
https://github.com/ethan-zf/cesium-plot-js.git
synced 2025-11-03 16:54:17 +00:00
change mouse style in editing mode
This commit is contained in:
parent
97357876f7
commit
996b545edf
24
src/base.ts
24
src/base.ts
@ -162,6 +162,7 @@ export default class Base {
|
|||||||
this.draggable();
|
this.draggable();
|
||||||
const entity = this.polygonEntity || this.lineEntity;
|
const entity = this.polygonEntity || this.lineEntity;
|
||||||
this.entityId = entity.id;
|
this.entityId = entity.id;
|
||||||
|
// this.entityId = `CesiumPlot-${entity.id}`;
|
||||||
/**
|
/**
|
||||||
* "I've noticed that CallbackProperty can lead to significant performance issues.
|
* "I've noticed that CallbackProperty can lead to significant performance issues.
|
||||||
* After drawing multiple shapes, the map becomes noticeably laggy. Using methods
|
* After drawing multiple shapes, the map becomes noticeably laggy. Using methods
|
||||||
@ -372,7 +373,7 @@ export default class Base {
|
|||||||
const pickedObject = this.viewer.scene.pick(event.position);
|
const pickedObject = this.viewer.scene.pick(event.position);
|
||||||
if (this.cesium.defined(pickedObject) && pickedObject.id instanceof CesiumTypeOnly.Entity) {
|
if (this.cesium.defined(pickedObject) && pickedObject.id instanceof CesiumTypeOnly.Entity) {
|
||||||
const clickedEntity = pickedObject.id;
|
const clickedEntity = pickedObject.id;
|
||||||
if (clickedEntity.id == this.entityId) {
|
if (this.isCurrentEntity(clickedEntity.id)) {
|
||||||
//Clicking on the current instance's entity initiates drag logic.
|
//Clicking on the current instance's entity initiates drag logic.
|
||||||
dragging = true;
|
dragging = true;
|
||||||
startPosition = cartesian;
|
startPosition = cartesian;
|
||||||
@ -408,6 +409,22 @@ export default class Base {
|
|||||||
this.setGeometryPoints(newPoints);
|
this.setGeometryPoints(newPoints);
|
||||||
startPosition = newPosition;
|
startPosition = newPosition;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const pickRay = this.viewer.scene.camera.getPickRay(event.endPosition);
|
||||||
|
if (pickRay) {
|
||||||
|
const pickedObject = this.viewer.scene.pick(event.endPosition);
|
||||||
|
if (this.cesium.defined(pickedObject) && pickedObject.id instanceof CesiumTypeOnly.Entity) {
|
||||||
|
const clickedEntity = pickedObject.id;
|
||||||
|
// TODO 绘制的图形,需要特殊id标识,可在创建entity时指定id
|
||||||
|
if (this.isCurrentEntity(clickedEntity.id)) {
|
||||||
|
this.viewer.scene.canvas.style.cursor = 'move';
|
||||||
|
} else {
|
||||||
|
this.viewer.scene.canvas.style.cursor = 'default';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.viewer.scene.canvas.style.cursor = 'default';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, this.cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
}, this.cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
||||||
|
|
||||||
@ -477,6 +494,11 @@ export default class Base {
|
|||||||
this.eventDispatcher.off(eventType, listener);
|
this.eventDispatcher.off(eventType, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isCurrentEntity(id: string) {
|
||||||
|
// return this.entityId === `CesiumPlot-${id}`;
|
||||||
|
return this.entityId === id;
|
||||||
|
}
|
||||||
|
|
||||||
addPoint(cartesian: CesiumTypeOnly.Cartesian3) {
|
addPoint(cartesian: CesiumTypeOnly.Cartesian3) {
|
||||||
//Abstract method that must be implemented by subclasses.
|
//Abstract method that must be implemented by subclasses.
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user