Skip to content

Commit

Permalink
Simplify foundry fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelVo committed May 6, 2021
1 parent 27a6235 commit 49542a6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/foundry_fixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

// https://gitlab.com/foundrynet/foundryvtt/-/issues/4705
export function getPixelsFromGridPosition(xGrid, yGrid) {
if (canvas.grid.isHex) {
if (canvas.grid.type !== CONST.GRID_TYPES.GRIDLESS) {
return canvas.grid.grid.getPixelsFromGridPosition(yGrid, xGrid)
}
const [x, y] = canvas.grid.grid.getPixelsFromGridPosition(xGrid, yGrid)
if (canvas.grid.type === CONST.GRID_TYPES.SQUARE)
return [y, x]
return [x, y]
return canvas.grid.grid.getPixelsFromGridPosition(xGrid, yGrid)
}

// Wrapper to fix a FoundryVTT bug that causes the return values of canvas.grid.grid.getPixelsFromGridPosition to be ordered inconsistently
Expand Down

0 comments on commit 49542a6

Please sign in to comment.