fix hex calculations in v12

This commit is contained in:
n0q
2024-07-27 10:22:35 -07:00
committed by Manuel Vögele
parent 0808f17ee3
commit 0e2ab35db7
2 changed files with 8 additions and 6 deletions
+3 -2
View File
@@ -157,7 +157,8 @@ export function getAreaFromPositionAndShape(position, shape) {
let y = position.y + space.y;
if (isCanvasHex()) {
let shiftedRow;
if (canvas.grid.grid.options.even) shiftedRow = 1;
// v12 ?? v11
if (canvas.grid?.even ?? canvas.grid.grid.options.even) shiftedRow = 1;
else shiftedRow = 0;
if (canvas.grid.grid.columnar) {
if (space.x % 2 !== 0 && position.x % 2 !== shiftedRow) {
@@ -329,4 +330,4 @@ function isCanvasHex() {
// isHexagonal is introduced in V12 (undefined in V11)
// isHex is deprecated since V12
return canvas.grid.isHexagonal ?? canvas.grid.isHex
}
}