Fix snapping for tokens that are smaller than 1x1 (fixes #48)

This commit is contained in:
Manuel Vögele
2021-03-25 01:54:53 +01:00
parent 0de01379e9
commit b4ac65e478
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ export function getSnapPointForToken(x, y, token) {
return new PIXI.Point(...canvas.grid.getCenter(x, y))
}
}
if (canvas.grid.isHex || token.data.width % 2 === 1) {
if (canvas.grid.isHex || Math.round(token.data.width) % 2 === 1 || token.data.width < 1) {
return new PIXI.Point(...canvas.grid.getCenter(x, y))
}
const [snappedX, snappedY] = canvas.grid.getCenter(x - canvas.grid.w / 2, y - canvas.grid.h / 2)