From 5904efbdd51166373c2fc780e84b896686fd06e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Sat, 7 May 2022 08:12:30 +0200 Subject: [PATCH] Remove redundant first waypoint from path generated by pathfinder This fixes a bug where gridless snapping would snap slightly below the target range --- js/foundry_imports.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/foundry_imports.js b/js/foundry_imports.js index 79a90b2..2e96cab 100644 --- a/js/foundry_imports.js +++ b/js/foundry_imports.js @@ -175,7 +175,9 @@ export function measure(destination, options={}) { const from = getGridPositionFromPixelsObj(this.waypoints[this.waypoints.length - 1]); const to = getGridPositionFromPixelsObj(destination); let path = findPath(from, to, this.draggedEntity, this.waypoints); - if (path) { + if (path) + path.shift(); + if (path && path.length > 0) { path = path.map(point => getSnapPointForTokenObj(getPixelsFromGridPositionObj(point), this.draggedEntity)); // If the token is snapped to the grid, the first point of the path is already handled by the ruler