Add hex support for default inset function

This commit is contained in:
Mitchell McCaffrey
2021-02-05 11:00:31 +11:00
parent e90b6dea49
commit 5dfddd6af9
5 changed files with 87 additions and 63 deletions

View File

@@ -8,7 +8,7 @@ import MapEditor from "../components/map/MapEditor";
import MapDataContext from "../contexts/MapDataContext";
import { isEmpty } from "../helpers/shared";
import { getMapDefaultInset } from "../helpers/grid";
import { getGridDefaultInset } from "../helpers/grid";
import useResponsiveLayout from "../hooks/useResponsiveLayout";
@@ -65,18 +65,16 @@ function EditMapModal({ isOpen, onDone, map, mapState }) {
inset.topLeft.y > inset.bottomRight.y
) {
if ("size" in verifiedChanges.grid) {
verifiedChanges.grid.inset = getMapDefaultInset(
verifiedChanges.grid.inset = getGridDefaultInset(
verifiedChanges.grid,
map.width,
map.height,
verifiedChanges.grid.size.x,
verifiedChanges.grid.size.y
map.height
);
} else {
verifiedChanges.grid.inset = getMapDefaultInset(
verifiedChanges.grid.inset = getGridDefaultInset(
map.grid,
map.width,
map.height,
map.grid.size.x,
map.grid.size.y
map.height
);
}
}