diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd16a2..53d5d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## In development +### Bugfixes +- Drag Ruler now works again on gridless maps + ## 1.4.1 ### Bugfixes - Fixed a bug where Drag Ruler wouldn't work at all on hex grids when the Hex Token Size Support isn't installed diff --git a/src/util.js b/src/util.js index 6ef2752..a17f2b9 100644 --- a/src/util.js +++ b/src/util.js @@ -57,9 +57,10 @@ export function getAreaFromPositionAndShape(position, shape) { } export function getTokenShape(token) { - if (token.scene.data.gridType === CONST.GRID_TYPES.GRIDLESS) - throw new Error("getTokenShape cannot be called for tokens on gridless maps") - if (token.scene.data.gridType === CONST.GRID_TYPES.SQUARE) { + if (token.scene.data.gridType === CONST.GRID_TYPES.GRIDLESS) { + return [{x: 0, y: 0}] + } + else if (token.scene.data.gridType === CONST.GRID_TYPES.SQUARE) { const topOffset = -Math.floor(token.data.height / 2) const leftOffset = -Math.floor(token.data.width / 2) const shape = []