Fix grid size change when grid is offset

This commit is contained in:
Mitchell McCaffrey 2020-10-09 15:35:47 +11:00
parent 1043f093cd
commit 076213fa25

View File

@ -44,7 +44,7 @@ function MapSettings({
if (value > 0) { if (value > 0) {
const gridScale = const gridScale =
((inset.bottomRight.x - inset.topLeft.x) * map.width) / value; ((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", { onSettingsChange("grid", {
@ -66,7 +66,7 @@ function MapSettings({
if (gridX > 0) { if (gridX > 0) {
const gridScale = const gridScale =
((inset.bottomRight.x - inset.topLeft.x) * map.width) / gridX; ((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", { onSettingsChange("grid", {