Allow getTokenShape on gridless maps (fixes #44)
This commit is contained in:
@@ -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
|
||||
|
||||
+4
-3
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user