Send a map clear before replace to ensure new state isn't show on old image

This commit is contained in:
Mitchell McCaffrey
2020-04-24 16:18:48 +10:00
parent db8e0c14fb
commit a4e1a898ad
3 changed files with 26 additions and 19 deletions

View File

@@ -251,6 +251,22 @@ function Map({
</Box>
);
const mapDrawing = (
<MapDrawing
width={map ? map.width : 0}
height={map ? map.height : 0}
selectedTool={selectedTool}
shapes={drawnShapes}
onShapeAdd={handleShapeAdd}
onShapeRemove={handleShapeRemove}
brushColor={brushColor}
useGridSnapping={useBrushGridSnapping}
gridSize={gridSizeNormalized}
useBrushBlending={useBrushBlending}
useBrushGesture={useBrushGesture}
/>
);
return (
<>
<Box
@@ -282,21 +298,9 @@ function Map({
paddingBottom: `${(1 / aspectRatio) * 100}%`,
}}
/>
{mapImage}
<MapDrawing
width={map ? map.width : 0}
height={map ? map.height : 0}
selectedTool={selectedTool}
shapes={drawnShapes}
onShapeAdd={handleShapeAdd}
onShapeRemove={handleShapeRemove}
brushColor={brushColor}
useGridSnapping={useBrushGridSnapping}
gridSize={gridSizeNormalized}
useBrushBlending={useBrushBlending}
useBrushGesture={useBrushGesture}
/>
{mapTokens}
{map && mapImage}
{map && mapDrawing}
{map && mapTokens}
</Box>
</Box>
<MapControls