From 076213fa25130b105f2e3368764608bd5987dc34 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 9 Oct 2020 15:35:47 +1100 Subject: [PATCH] Fix grid size change when grid is offset --- src/components/map/MapSettings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/map/MapSettings.js b/src/components/map/MapSettings.js index 9e5ccc3..78090aa 100644 --- a/src/components/map/MapSettings.js +++ b/src/components/map/MapSettings.js @@ -44,7 +44,7 @@ function MapSettings({ if (value > 0) { const gridScale = ((inset.bottomRight.x - inset.topLeft.x) * map.width) / value; - inset.bottomRight.y = (gridY * gridScale) / map.height; + inset.bottomRight.y = inset.topLeft.y + (gridY * gridScale) / map.height; } onSettingsChange("grid", { @@ -66,7 +66,7 @@ function MapSettings({ if (gridX > 0) { const gridScale = ((inset.bottomRight.x - inset.topLeft.x) * map.width) / gridX; - inset.bottomRight.y = (value * gridScale) / map.height; + inset.bottomRight.y = inset.topLeft.y + (value * gridScale) / map.height; } onSettingsChange("grid", {