diff --git a/src/foundry_imports.js b/src/foundry_imports.js index 7a3883c..7135e4b 100644 --- a/src/foundry_imports.js +++ b/src/foundry_imports.js @@ -166,13 +166,17 @@ export function measure(destination, options={}) { } // Remove waypoints generated by pathfinding + this.waypoints.filter(waypoint => waypoint.isPathfinding).forEach(_ => this.labels.removeChild(this.labels.children.pop())); this.waypoints = this.waypoints.filter(waypoint => !waypoint.isPathfinding); if (isToken && options.pathfinding) { let path = findPath(getGridPositionFromPixelsObj(this.waypoints[this.waypoints.length - 1]), getGridPositionFromPixelsObj(destination)); if (path) { path = path.map(point => getCenterFromGridPositionObj(point)); - path.forEach(point => point.isPathfinding = true); + for (const point of path) { + point.isPathfinding = true; + this.labels.addChild(new PreciseText("", CONFIG.canvasTextStyle)); + } this.waypoints = this.waypoints.concat(path); } else {