Remove grid editor for default maps
This commit is contained in:
parent
f5c1cf8c98
commit
9314e0c609
@ -117,6 +117,8 @@ function MapEditor({ map, onSettingsChange }) {
|
|||||||
mapHeight,
|
mapHeight,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const canEditGrid = map.type !== "default";
|
||||||
|
|
||||||
const gridChanged =
|
const gridChanged =
|
||||||
map.grid.inset.topLeft.x !== defaultInset.topLeft.x ||
|
map.grid.inset.topLeft.x !== defaultInset.topLeft.x ||
|
||||||
map.grid.inset.topLeft.y !== defaultInset.topLeft.y ||
|
map.grid.inset.topLeft.y !== defaultInset.topLeft.y ||
|
||||||
@ -149,8 +151,10 @@ function MapEditor({ map, onSettingsChange }) {
|
|||||||
<Layer ref={mapLayerRef}>
|
<Layer ref={mapLayerRef}>
|
||||||
<Image image={mapImageSource} width={mapWidth} height={mapHeight} />
|
<Image image={mapImageSource} width={mapWidth} height={mapHeight} />
|
||||||
<MapInteractionProvider value={mapInteraction}>
|
<MapInteractionProvider value={mapInteraction}>
|
||||||
{showGridControls && <MapGrid map={map} strokeWidth={0.5} />}
|
{showGridControls && canEditGrid && (
|
||||||
{showGridControls && (
|
<MapGrid map={map} strokeWidth={0.5} />
|
||||||
|
)}
|
||||||
|
{showGridControls && canEditGrid && (
|
||||||
<MapGridEditor map={map} onGridChange={handleGridChange} />
|
<MapGridEditor map={map} onGridChange={handleGridChange} />
|
||||||
)}
|
)}
|
||||||
</MapInteractionProvider>
|
</MapInteractionProvider>
|
||||||
@ -169,19 +173,26 @@ function MapEditor({ map, onSettingsChange }) {
|
|||||||
<ResetMapIcon />
|
<ResetMapIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
<IconButton
|
{canEditGrid && (
|
||||||
title={showGridControls ? "Hide Grid Controls" : "Show Grid Controls"}
|
<IconButton
|
||||||
aria-label={
|
title={showGridControls ? "Hide Grid Controls" : "Show Grid Controls"}
|
||||||
showGridControls ? "Hide Grid Controls" : "Show Grid Controls"
|
aria-label={
|
||||||
}
|
showGridControls ? "Hide Grid Controls" : "Show Grid Controls"
|
||||||
onClick={() => setShowGridControls(!showGridControls)}
|
}
|
||||||
bg="overlay"
|
onClick={() => setShowGridControls(!showGridControls)}
|
||||||
sx={{ borderRadius: "50%", position: "absolute", bottom: 0, right: 0 }}
|
bg="overlay"
|
||||||
m={2}
|
sx={{
|
||||||
p="6px"
|
borderRadius: "50%",
|
||||||
>
|
position: "absolute",
|
||||||
{showGridControls ? <GridOnIcon /> : <GridOffIcon />}
|
bottom: 0,
|
||||||
</IconButton>
|
right: 0,
|
||||||
|
}}
|
||||||
|
m={2}
|
||||||
|
p="6px"
|
||||||
|
>
|
||||||
|
{showGridControls ? <GridOnIcon /> : <GridOffIcon />}
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user