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
|
## 1.4.1
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- Fixed a bug where Drag Ruler wouldn't work at all on hex grids when the Hex Token Size Support isn't installed
|
- 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) {
|
export function getTokenShape(token) {
|
||||||
if (token.scene.data.gridType === CONST.GRID_TYPES.GRIDLESS)
|
if (token.scene.data.gridType === CONST.GRID_TYPES.GRIDLESS) {
|
||||||
throw new Error("getTokenShape cannot be called for tokens on gridless maps")
|
return [{x: 0, y: 0}]
|
||||||
if (token.scene.data.gridType === CONST.GRID_TYPES.SQUARE) {
|
}
|
||||||
|
else if (token.scene.data.gridType === CONST.GRID_TYPES.SQUARE) {
|
||||||
const topOffset = -Math.floor(token.data.height / 2)
|
const topOffset = -Math.floor(token.data.height / 2)
|
||||||
const leftOffset = -Math.floor(token.data.width / 2)
|
const leftOffset = -Math.floor(token.data.width / 2)
|
||||||
const shape = []
|
const shape = []
|
||||||
|
|||||||
Reference in New Issue
Block a user