- minor improvements to painter

This commit is contained in:
2025-11-24 13:29:00 +00:00
parent b084c3016d
commit 8dd20e409c
4 changed files with 55 additions and 29 deletions

View File

@@ -13,14 +13,14 @@ const gap = 0;
type VideoFeedGridPainterProps = {
regions: Region[];
selectedRegionIndex: number;
isErasing: boolean;
mode: string;
};
type PaintedCell = {
colour: string;
};
const VideoFeedGridPainter = ({ regions, selectedRegionIndex, isErasing }: VideoFeedGridPainterProps) => {
const VideoFeedGridPainter = ({ regions, selectedRegionIndex, mode }: VideoFeedGridPainterProps) => {
const { latestBitmapRef, isloading } = useCreateVideoSnapshot();
const [stageSize, setStageSize] = useState({ width: 740, height: 460 });
const isDrawingRef = useRef(false);
@@ -53,7 +53,7 @@ const VideoFeedGridPainter = ({ regions, selectedRegionIndex, isErasing }: Video
const map = paintedCellsRef.current;
const existing = map.get(key);
if (isErasing) {
if (mode === "eraser") {
if (map.has(key)) {
map.delete(key);
paintLayerRef.current?.batchDraw();