Added snap to grid option to map settings

This commit is contained in:
Mitchell McCaffrey
2020-08-07 12:28:50 +10:00
parent 6b97614a60
commit 76cad29f2b
9 changed files with 52 additions and 55 deletions

View File

@@ -18,6 +18,7 @@ import { getRelativePointerPositionNormalized } from "../../helpers/konva";
import colors from "../../helpers/colors";
function MapDrawing({
map,
shapes,
onShapeAdd,
onShapesRemove,
@@ -52,6 +53,7 @@ function MapDrawing({
function getBrushPosition() {
const mapImage = mapStage.findOne("#mapImage");
return getBrushPositionForTool(
map,
getRelativePointerPositionNormalized(mapImage),
toolId,
toolSettings,
@@ -153,23 +155,7 @@ function MapDrawing({
interactionEmitter.off("drag", handleBrushMove);
interactionEmitter.off("dragEnd", handleBrushUp);
};
}, [
drawingShape,
erasingShapes,
gridSize,
isBrush,
isBrushDown,
active,
toolId,
isShape,
mapStageRef,
onShapeAdd,
onShapesRemove,
toolSettings,
shapes,
stageScale,
interactionEmitter,
]);
});
function handleShapeOver(shape, isDown) {
if (shouldHover && isDown) {