From 79c9e449fc36dc020765b2400168b3dd0d9e3d89 Mon Sep 17 00:00:00 2001 From: ethan Date: Mon, 4 Sep 2023 10:01:17 +0800 Subject: [PATCH] Fixed the issue with the line connecting the first two points of the SquadCombat. --- src/arrow/squad-combat.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/arrow/squad-combat.ts b/src/arrow/squad-combat.ts index 984aa8c..1ea42f2 100644 --- a/src/arrow/squad-combat.ts +++ b/src/arrow/squad-combat.ts @@ -22,6 +22,18 @@ export default class SquadCombat extends AttackArrow { this.tailWidthFactor = 0.1; } + /** + * Add points only on click events + */ + addPoint(cartesian: Cartesian3) { + this.points.push(cartesian); + if (this.points.length < 2) { + this.onMouseMove(); + } else if (this.points.length > 2) { + this.lineEntity && this.viewer.entities.remove(this.lineEntity); + } + } + /** * Draw a shape based on mouse movement points during the initial drawing. */