Fix a bug where tokens wouldn't be moved to the corect end position on gridless maps

This commit is contained in:
Manuel Vögele
2021-02-05 00:54:09 +01:00
parent fe89a871c9
commit 46edfa8ae6
2 changed files with 15 additions and 4 deletions
+4
View File
@@ -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 ## v1.1.0
### New features ### 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) - 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)
+10 -3
View File
@@ -44,10 +44,17 @@ async function animateToken(token, rays, tokenOffset, wasPaused) {
// Determine offset relative to the Token top-left. // 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. // 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); 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; const s2 = canvas.dimensions.size / 2;
const dx = Math.round((token.data.x - origin[0]) / s2) * s2; dx = Math.round((token.data.x - origin[0]) / s2) * s2;
const dy = Math.round((token.data.y - origin[1]) / s2) * s2; dy = Math.round((token.data.y - origin[1]) / s2) * s2;
}
token._noAnimate = true; token._noAnimate = true;
for (let r of offsetRays) { for (let r of offsetRays) {