Use token.center instead of calculating the center manually

This commit is contained in:
Manuel Vögele
2023-06-13 18:25:42 +02:00
parent 79db620fc1
commit af03341638
+2 -3
View File
@@ -133,10 +133,9 @@ export function getColorForDistanceAndToken(distance, token, ranges = null) {
export function getMovedDistanceFromToken(token) {
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active;
const history = getMovementHistory(token);
const tokenPos = {x: token.x, y: token.y};
let tokenPos = {x: token.x, y: token.y};
if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) {
tokenPos.x += token.w / 2;
tokenPos.y += token.h / 2;
tokenPos = token.center;
}
const segments = CONFIG.Canvas.rulerClass
.dragRulerGetRaysFromWaypoints(history, tokenPos)