Use token.center instead of calculating the center manually
This commit is contained in:
+2
-3
@@ -133,10 +133,9 @@ export function getColorForDistanceAndToken(distance, token, ranges = null) {
|
|||||||
export function getMovedDistanceFromToken(token) {
|
export function getMovedDistanceFromToken(token) {
|
||||||
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active;
|
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active;
|
||||||
const history = getMovementHistory(token);
|
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) {
|
if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) {
|
||||||
tokenPos.x += token.w / 2;
|
tokenPos = token.center;
|
||||||
tokenPos.y += token.h / 2;
|
|
||||||
}
|
}
|
||||||
const segments = CONFIG.Canvas.rulerClass
|
const segments = CONFIG.Canvas.rulerClass
|
||||||
.dragRulerGetRaysFromWaypoints(history, tokenPos)
|
.dragRulerGetRaysFromWaypoints(history, tokenPos)
|
||||||
|
|||||||
Reference in New Issue
Block a user