修复双箭头整体被拖拽后生长动画路径不正确的问题

This commit is contained in:
ethan 2024-05-20 19:25:00 +08:00
parent c08826089d
commit c8b7d15d6e
2 changed files with 10 additions and 7 deletions

View File

@ -53,8 +53,6 @@ export default class DoubleArrow extends Base {
this.lineEntity && this.viewer.entities.remove(this.lineEntity);
} else {
this.finishDrawing();
this.curveControlPointLeft = this.cesium.Cartesian3.fromDegrees(this.llBodyPnts[2][0], this.llBodyPnts[2][1]);
this.curveControlPointRight = this.cesium.Cartesian3.fromDegrees(this.rrBodyPnts[1][0], this.rrBodyPnts[1][1]);
// // 辅助查看插值控制点位置
// this.viewer.entities.add({
@ -76,11 +74,11 @@ export default class DoubleArrow extends Base {
}
}
// finishDrawing() {
// this.curveControlPointLeft = this.cesium.Cartesian3.fromDegrees(this.llBodyPnts[2][0], this.llBodyPnts[2][1]);
// this.curveControlPointRight = this.cesium.Cartesian3.fromDegrees(this.rrBodyPnts[1][0], this.rrBodyPnts[1][1]);
// super.finishDrawing();
// }
finishDrawing() {
this.curveControlPointLeft = this.cesium.Cartesian3.fromDegrees(this.llBodyPnts[2][0], this.llBodyPnts[2][1]);
this.curveControlPointRight = this.cesium.Cartesian3.fromDegrees(this.rrBodyPnts[1][0], this.rrBodyPnts[1][1]);
super.finishDrawing();
}
/**
* Draw a shape based on mouse movement points during the initial drawing.
*/

View File

@ -441,6 +441,11 @@ export default class Base {
});
this.setGeometryPoints(newPoints);
if (this.minPointsForShape === 4) {
// 双箭头在整体被拖拽时,需要同步更新生长动画的插值点
this.curveControlPointLeft = this.cesium.Cartesian3.add(this.curveControlPointLeft, translation, new this.cesium.Cartesian3());
this.curveControlPointRight = this.cesium.Cartesian3.add(this.curveControlPointRight, translation, new this.cesium.Cartesian3());
}
startPosition = newPosition;
}
} else {