Fix map grid settings showing with an invalid grid

This commit is contained in:
Mitchell McCaffrey 2021-06-12 13:17:46 +10:00
parent 3d74dfc88a
commit 495fa84cb5

View File

@ -99,6 +99,8 @@ function MapEditor({ map, onSettingsChange }) {
map.grid.inset.bottomRight.x !== defaultInset.bottomRight.x ||
map.grid.inset.bottomRight.y !== defaultInset.bottomRight.y;
const gridValid = map.grid.size.x !== 0 && map.grid.size.y !== 0;
const layout = useResponsiveLayout();
return (
@ -131,7 +133,7 @@ function MapEditor({ map, onSettingsChange }) {
>
<Layer ref={mapLayerRef}>
<Image image={mapImage} width={mapWidth} height={mapHeight} />
{showGridControls && (
{showGridControls && gridValid && (
<>
<MapGrid map={map} />
<MapGridEditor map={map} onGridChange={handleGridChange} />
@ -140,7 +142,7 @@ function MapEditor({ map, onSettingsChange }) {
</Layer>
</KonvaBridge>
</ReactResizeDetector>
{gridChanged && (
{gridChanged && gridValid && (
<IconButton
title="Reset Grid"
aria-label="Reset Grid"