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 n = Object.keys(objectMaskPoints).filter((name) => name.startsWith('object_')).length;
const newObjectName = `object_${n}`;
const newObjectMaskPoints = { ...objectMaskPoints, [newObjectName]: [] };
const newObjectMaskPoints = { ...objectMaskPoints, [newObjectName]: [[]] };
setObjectMaskPoints(newObjectMaskPoints);
setEditing({ set: newObjectMaskPoints, key: newObjectName, subkey: 0, fn: setObjectMaskPoints });
}, [objectMaskPoints, setObjectMaskPoints, setEditing]);
@ -242,7 +242,7 @@ ${Object.keys(objectMaskPoints)
<CameraImage imageRef={imageRef} camera={camera} />
<EditableMask
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}
snap={snap}
width={width}