diff --git a/src/components/map/MapGrid.js b/src/components/map/MapGrid.js
index 54bd306..1d43e55 100644
--- a/src/components/map/MapGrid.js
+++ b/src/components/map/MapGrid.js
@@ -28,18 +28,25 @@ function MapGrid({ map, strokeWidth }) {
x: gridX ? 1 / gridX : 0,
y: gridY ? 1 / gridY : 0,
};
+ const gridInset = map && map.grid.inset;
const { mapWidth, mapHeight } = useContext(MapInteractionContext);
- const lineSpacingX = mapWidth / gridX;
- const lineSpacingY = mapHeight / gridY;
+ const insetWidth = (gridInset.bottomRight.x - gridInset.topLeft.x) * mapWidth;
+ const insetHeight =
+ (gridInset.bottomRight.y - gridInset.topLeft.y) * mapHeight;
+
+ const lineSpacingX = insetWidth / gridX;
+ const lineSpacingY = insetHeight / gridY;
+
+ const offsetX = gridInset.topLeft.x * mapWidth * -1;
+ const offsetY = gridInset.topLeft.y * mapHeight * -1;
const [isImageLight, setIsImageLight] = useState(true);
// When the map changes find the average lightness of its pixels
useEffect(() => {
if (mapLoadingStatus === "loaded") {
- console.log("getting lightness");
setIsImageLight(getImageLightness(mapImage));
}
}, [mapImage, mapLoadingStatus]);
@@ -49,7 +56,7 @@ function MapGrid({ map, strokeWidth }) {
lines.push(
);
}
@@ -65,7 +74,7 @@ function MapGrid({ map, strokeWidth }) {
lines.push(
);
}