Add basic hex functionality and clean up hooks and Vector2 class

This commit is contained in:
Mitchell McCaffrey
2021-02-04 15:06:34 +11:00
parent 924b3e2481
commit de84e77e58
61 changed files with 835 additions and 573 deletions

View File

@@ -5,9 +5,10 @@ import { useSpring, animated } from "react-spring/konva";
import AuthContext from "../../contexts/AuthContext";
import MapInteractionContext from "../../contexts/MapInteractionContext";
import { snapNodeToMap } from "../../helpers/map";
import { snapNodeToGrid } from "../../helpers/grid";
import colors from "../../helpers/colors";
import usePrevious from "../../helpers/usePrevious";
import usePrevious from "../../hooks/usePrevious";
const snappingThreshold = 1 / 5;
@@ -38,7 +39,13 @@ function Note({
const noteGroup = event.target;
// Snap to corners of grid
if (map.snapToGrid) {
snapNodeToMap(map, mapWidth, mapHeight, noteGroup, snappingThreshold);
snapNodeToGrid(
map.grid,
mapWidth,
mapHeight,
noteGroup,
snappingThreshold
);
}
}