From bbe86a4632a229c7f62e0cddd9266c38c5f8e30c Mon Sep 17 00:00:00 2001 From: martabal <74269598+martabal@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:09:08 +0100 Subject: [PATCH] move the selected unassigned faces to the person side panel --- .../faces-page/person-side-panel.svelte | 77 +++++++++++++++---- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/web/src/lib/components/faces-page/person-side-panel.svelte b/web/src/lib/components/faces-page/person-side-panel.svelte index 8ca462cf7..aded8ae0f 100644 --- a/web/src/lib/components/faces-page/person-side-panel.svelte +++ b/web/src/lib/components/faces-page/person-side-panel.svelte @@ -149,6 +149,12 @@ selectedPersonToAdd = selectedPersonToAdd.filter((_, index) => index !== indexToRemove); }; + const handleAddRemovedFace = (indexToRemove: number) => { + $boundingBoxesArray = []; + selectedPersonToUnassign = selectedPersonToUnassign.filter((_, index) => index !== indexToRemove); + peopleWithFaces = peopleWithFaces + }; + const handleUnassignFaces = async () => { if (numberOfFacesToUnassign > 0) { for (let i = 0; i < peopleWithFaces.length; i++) { @@ -157,6 +163,12 @@ if (image) { unassignedFaces[i] = { ...peopleWithFaces[i], customThumbnail: image }; selectedPersonToUnassign.push(peopleWithFaces[i]); + if (selectedPersonToReassign[i]) { + selectedPersonToReassign[i] = null; + } + if (selectedPersonToCreate[i]) { + selectedPersonToCreate[i] = null; + } } } } @@ -250,15 +262,7 @@ showSeletecFaces = false; }; - const handleCreatePersonFromUnassignedFace = (face: FaceWithGeneretedThumbnail) => { - selectedPersonToAdd.push(face); - const uniqueIds = new Set(selectedPersonToAdd.map((objA) => objA.id)); - selectedPersonToUnassign = selectedPersonToUnassign.filter((objB) => !uniqueIds.has(objB.id)); - selectedPersonToAdd = selectedPersonToAdd; - showUnassignedFaces = false; - }; - - const handleReassignFaceFromUnassignedFace = (face: FaceWithGeneretedThumbnail) => { + const handleCreateOrReassignFaceFromUnassignedFace = (face: FaceWithGeneretedThumbnail) => { selectedPersonToAdd.push(face); const uniqueIds = new Set(selectedPersonToAdd.map((objA) => objA.id)); selectedPersonToUnassign = selectedPersonToUnassign.filter((objB) => !uniqueIds.has(objB.id)); @@ -357,7 +361,7 @@ {:else} {#each peopleWithFaces as face, index} - {#if face.person && unassignedFaces[index] === null} + {#if face.person && unassignedFaces[index] === null && !selectedPersonToUnassign.some((unassignedFace) => unassignedFace.id === face.id)}
+ {face.person?.name} +
{/if} + {#if !isSelectingFaces} +