Remove redundant first waypoint from path generated by pathfinder
This fixes a bug where gridless snapping would snap slightly below the target range
This commit is contained in:
@@ -175,7 +175,9 @@ export function measure(destination, options={}) {
|
|||||||
const from = getGridPositionFromPixelsObj(this.waypoints[this.waypoints.length - 1]);
|
const from = getGridPositionFromPixelsObj(this.waypoints[this.waypoints.length - 1]);
|
||||||
const to = getGridPositionFromPixelsObj(destination);
|
const to = getGridPositionFromPixelsObj(destination);
|
||||||
let path = findPath(from, to, this.draggedEntity, this.waypoints);
|
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));
|
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
|
// If the token is snapped to the grid, the first point of the path is already handled by the ruler
|
||||||
|
|||||||
Reference in New Issue
Block a user