From 9314e0c609f47287672f168adebc4d74ee371bdc Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 9 Oct 2020 13:07:27 +1100 Subject: [PATCH] Remove grid editor for default maps --- src/components/map/MapEditor.js | 41 +++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/components/map/MapEditor.js b/src/components/map/MapEditor.js index da42ae1..cdf0ca9 100644 --- a/src/components/map/MapEditor.js +++ b/src/components/map/MapEditor.js @@ -117,6 +117,8 @@ function MapEditor({ map, onSettingsChange }) { mapHeight, }; + const canEditGrid = map.type !== "default"; + const gridChanged = map.grid.inset.topLeft.x !== defaultInset.topLeft.x || map.grid.inset.topLeft.y !== defaultInset.topLeft.y || @@ -149,8 +151,10 @@ function MapEditor({ map, onSettingsChange }) { - {showGridControls && } - {showGridControls && ( + {showGridControls && canEditGrid && ( + + )} + {showGridControls && canEditGrid && ( )} @@ -169,19 +173,26 @@ function MapEditor({ map, onSettingsChange }) { )} - setShowGridControls(!showGridControls)} - bg="overlay" - sx={{ borderRadius: "50%", position: "absolute", bottom: 0, right: 0 }} - m={2} - p="6px" - > - {showGridControls ? : } - + {canEditGrid && ( + setShowGridControls(!showGridControls)} + bg="overlay" + sx={{ + borderRadius: "50%", + position: "absolute", + bottom: 0, + right: 0, + }} + m={2} + p="6px" + > + {showGridControls ? : } + + )} ); }