Added shared grid context and moved away from calling useContext directly
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
import React, { useContext, useRef } from "react";
|
||||
import React, { useRef } from "react";
|
||||
import { Group, Circle, Rect } from "react-konva";
|
||||
|
||||
import MapInteractionContext from "../../contexts/MapInteractionContext";
|
||||
import { useMapInteraction } from "../../contexts/MapInteractionContext";
|
||||
import { useKeyboard } from "../../contexts/KeyboardContext";
|
||||
|
||||
import Vector2 from "../../helpers/Vector2";
|
||||
|
||||
import useKeyboard from "../../hooks/useKeyboard";
|
||||
|
||||
function MapGridEditor({ map, onGridChange }) {
|
||||
const {
|
||||
mapWidth,
|
||||
mapHeight,
|
||||
stageScale,
|
||||
setPreventMapInteraction,
|
||||
} = useContext(MapInteractionContext);
|
||||
} = useMapInteraction();
|
||||
|
||||
const mapSize = { x: mapWidth, y: mapHeight };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user