Remove blank rect from map fog

This commit is contained in:
Mitchell McCaffrey 2021-05-20 12:22:22 +10:00
parent ef73ca0179
commit 3a68c47de6

View File

@ -1,6 +1,6 @@
import React, { useState, useEffect, useCallback, useRef } from "react"; import React, { useState, useEffect, useCallback } from "react";
import shortid from "shortid"; import shortid from "shortid";
import { Group, Rect, Line } from "react-konva"; import { Group, Line } from "react-konva";
import useImage from "use-image"; import useImage from "use-image";
import diagonalPattern from "../../images/DiagonalPattern.png"; import diagonalPattern from "../../images/DiagonalPattern.png";
@ -590,15 +590,9 @@ function MapFog({
} }
}, [shapes, editable, active, toolSettings, shouldRenderGuides]); }, [shapes, editable, active, toolSettings, shouldRenderGuides]);
const fogGroupRef = useRef();
return ( return (
<Group> <Group>
<Group ref={fogGroupRef}> <Group>{fogShapes.map(renderShape)}</Group>
{/* Render a blank shape so cache works with no fog shapes */}
<Rect width={1} height={1} />
{fogShapes.map(renderShape)}
</Group>
{shouldRenderGuides && renderGuides()} {shouldRenderGuides && renderGuides()}
{drawingShape && renderShape(drawingShape)} {drawingShape && renderShape(drawingShape)}
{drawingShape && {drawingShape &&