diff --git a/src/arrow/double-arrow.ts b/src/arrow/double-arrow.ts index 3dcf1a8..38ed574 100644 --- a/src/arrow/double-arrow.ts +++ b/src/arrow/double-arrow.ts @@ -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. */ diff --git a/src/base.ts b/src/base.ts index 0437858..4d38881 100644 --- a/src/base.ts +++ b/src/base.ts @@ -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 {