diff --git a/CHANGELOG.md b/CHANGELOG.md index 85b77e0..0f58c64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## In development +### Bugfixes +- Fixed a bug where tokens wouldn't be moved to the corect end position on gridless maps + ## v1.1.0 ### New features - The drag ruler will now be colored for other players than the dragging player as well (only if they have at least observer permissions for that token) diff --git a/src/foundry_imports.js b/src/foundry_imports.js index 58402d2..2c8263b 100644 --- a/src/foundry_imports.js +++ b/src/foundry_imports.js @@ -44,10 +44,17 @@ async function animateToken(token, rays, tokenOffset, wasPaused) { // Determine offset relative to the Token top-left. // This is important so we can position the token relative to the ruler origin for non-1x1 tokens. - const origin = canvas.grid.getTopLeft(this.waypoints[0].x + tokenOffset.x, this.waypoints[0].y + tokenOffset.y); - const s2 = canvas.dimensions.size / 2; - const dx = Math.round((token.data.x - origin[0]) / s2) * s2; - const dy = Math.round((token.data.y - origin[1]) / s2) * s2; + origin = canvas.grid.getTopLeft(this.waypoints[0].x + tokenOffset.x, this.waypoints[0].y + tokenOffset.y); + let dx, dy + if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) { + dx = token.data.x - origin[0] + dy = token.data.y - origin[1] + } + else { + const s2 = canvas.dimensions.size / 2; + dx = Math.round((token.data.x - origin[0]) / s2) * s2; + dy = Math.round((token.data.y - origin[1]) / s2) * s2; + } token._noAnimate = true; for (let r of offsetRays) {