diff --git a/src/components/map/MapFog.js b/src/components/map/MapFog.js index 43b4ea4..963f677 100644 --- a/src/components/map/MapFog.js +++ b/src/components/map/MapFog.js @@ -2,6 +2,7 @@ import React, { useState, useEffect, useCallback } from "react"; import shortid from "shortid"; import { Group, Line } from "react-konva"; import useImage from "use-image"; +import Color from "color"; import diagonalPattern from "../../images/DiagonalPattern.png"; @@ -489,6 +490,17 @@ function MapFog({ const holes = shape.data.holes && shape.data.holes.map((hole) => hole.reduce(reducePoints, [])); + const opacity = editable + ? !shape.visible + ? editOpacity / 2 + : editOpacity + : 1; + // Control opacity only on fill as using opacity with stroke leads to performance issues + const fill = new Color(colors[shape.color] || shape.color).alpha(opacity); + const stroke = + editable && active + ? colors.lightGray + : colors[shape.color] || shape.color; return (