Fix map grid settings showing with an invalid grid
This commit is contained in:
parent
3d74dfc88a
commit
495fa84cb5
@ -99,6 +99,8 @@ function MapEditor({ map, onSettingsChange }) {
|
|||||||
map.grid.inset.bottomRight.x !== defaultInset.bottomRight.x ||
|
map.grid.inset.bottomRight.x !== defaultInset.bottomRight.x ||
|
||||||
map.grid.inset.bottomRight.y !== defaultInset.bottomRight.y;
|
map.grid.inset.bottomRight.y !== defaultInset.bottomRight.y;
|
||||||
|
|
||||||
|
const gridValid = map.grid.size.x !== 0 && map.grid.size.y !== 0;
|
||||||
|
|
||||||
const layout = useResponsiveLayout();
|
const layout = useResponsiveLayout();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -131,7 +133,7 @@ function MapEditor({ map, onSettingsChange }) {
|
|||||||
>
|
>
|
||||||
<Layer ref={mapLayerRef}>
|
<Layer ref={mapLayerRef}>
|
||||||
<Image image={mapImage} width={mapWidth} height={mapHeight} />
|
<Image image={mapImage} width={mapWidth} height={mapHeight} />
|
||||||
{showGridControls && (
|
{showGridControls && gridValid && (
|
||||||
<>
|
<>
|
||||||
<MapGrid map={map} />
|
<MapGrid map={map} />
|
||||||
<MapGridEditor map={map} onGridChange={handleGridChange} />
|
<MapGridEditor map={map} onGridChange={handleGridChange} />
|
||||||
@ -140,7 +142,7 @@ function MapEditor({ map, onSettingsChange }) {
|
|||||||
</Layer>
|
</Layer>
|
||||||
</KonvaBridge>
|
</KonvaBridge>
|
||||||
</ReactResizeDetector>
|
</ReactResizeDetector>
|
||||||
{gridChanged && (
|
{gridChanged && gridValid && (
|
||||||
<IconButton
|
<IconButton
|
||||||
title="Reset Grid"
|
title="Reset Grid"
|
||||||
aria-label="Reset Grid"
|
aria-label="Reset Grid"
|
||||||
|
Loading…
Reference in New Issue
Block a user