fix(web): object mask editing not showing points

This commit is contained in:
Paul Armstrong 2021-01-26 07:17:51 -08:00 committed by Blake Blackshear
parent 26e7d34f18
commit d4e512c1fc

View File

@ -190,7 +190,7 @@ ${Object.keys(zonePoints)
const handleAddObjectMask = useCallback(() => { const handleAddObjectMask = useCallback(() => {
const n = Object.keys(objectMaskPoints).filter((name) => name.startsWith('object_')).length; const n = Object.keys(objectMaskPoints).filter((name) => name.startsWith('object_')).length;
const newObjectName = `object_${n}`; const newObjectName = `object_${n}`;
const newObjectMaskPoints = { ...objectMaskPoints, [newObjectName]: [] }; const newObjectMaskPoints = { ...objectMaskPoints, [newObjectName]: [[]] };
setObjectMaskPoints(newObjectMaskPoints); setObjectMaskPoints(newObjectMaskPoints);
setEditing({ set: newObjectMaskPoints, key: newObjectName, subkey: 0, fn: setObjectMaskPoints }); setEditing({ set: newObjectMaskPoints, key: newObjectName, subkey: 0, fn: setObjectMaskPoints });
}, [objectMaskPoints, setObjectMaskPoints, setEditing]); }, [objectMaskPoints, setObjectMaskPoints, setEditing]);
@ -242,7 +242,7 @@ ${Object.keys(objectMaskPoints)
<CameraImage imageRef={imageRef} camera={camera} /> <CameraImage imageRef={imageRef} camera={camera} />
<EditableMask <EditableMask
onChange={handleUpdateEditable} onChange={handleUpdateEditable}
points={editing.subkey ? editing.set[editing.key][editing.subkey] : editing.set[editing.key]} points={'subkey' in editing ? editing.set[editing.key][editing.subkey] : editing.set[editing.key]}
scale={imageScale} scale={imageScale}
snap={snap} snap={snap}
width={width} width={width}