From cab185df66ada3519618c5bdf2653b7c6e6b1e28 Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Thu, 5 Feb 2026 22:36:49 +0100 Subject: [PATCH] Made gridless distances lean towards being in the lower range (#1639) --- module/canvas/placeables/token.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/canvas/placeables/token.mjs b/module/canvas/placeables/token.mjs index bc5c2a01..068f21e1 100644 --- a/module/canvas/placeables/token.mjs +++ b/module/canvas/placeables/token.mjs @@ -1,4 +1,4 @@ -import DhMeasuredTemplate from "./measuredTemplate.mjs"; +import DhMeasuredTemplate from './measuredTemplate.mjs'; export default class DhTokenPlaceable extends foundry.canvas.placeables.Token { /** @inheritdoc */ @@ -63,7 +63,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token { const originRadius = (this.bounds.width * boundsCorrection) / 2; const targetRadius = (target.bounds.width * boundsCorrection) / 2; const distance = canvas.grid.measurePath([originPoint, destinationPoint]).distance; - return distance - originRadius - targetRadius + canvas.grid.distance; + return Math.floor(distance - originRadius - targetRadius + canvas.grid.distance); } // Compute what the closest grid space of each token is, then compute that distance @@ -85,7 +85,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token { // Check if the setting is enabled const setting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance).showTokenDistance; - if (setting === "never" || (setting === "encounters" && !game.combat?.started)) return; + if (setting === 'never' || (setting === 'encounters' && !game.combat?.started)) return; // Check if this token isn't invisible and is actually being hovered const isTokenValid =