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
+7 -9
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
);
}
}
+2 -2
View File
@@ -16,7 +16,7 @@ import blobToBuffer from "../helpers/blobToBuffer";
import { resizeImage } from "../helpers/image";
import { useSearch, useGroup, handleItemSelect } from "../helpers/select";
import {
getMapDefaultInset,
getGridDefaultInset,
getGridSize,
gridSizeVaild,
} from "../helpers/grid";
@@ -206,7 +206,7 @@ function SelectMapModal({
type: "file",
grid: {
size: gridSize,
inset: getMapDefaultInset(
inset: getGridDefaultInset(
image.width,
image.height,
gridSize.x,