fix: bounding box label clipping due to reactivity issue (#32107)
fix: bounding box label clipping due to reactivity issue (#32090) (cherry picked from commit a01a9140b6f1a01e2c80278d5cc2505e1fd1a12d) Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
This commit is contained in:
co-authored by
Daniel Dietzler
parent
17e4cfd96b
commit
bf04a9fc35
@@ -173,9 +173,12 @@
|
||||
|
||||
const faces = $derived(Array.from(faceToNameMap.keys()));
|
||||
|
||||
const boundingBoxes = $derived.by(() => {
|
||||
// we want to bind to `boundingbox.labelWidth`, which requires deep reactivity
|
||||
// $derived does not currently support that, only $state does.
|
||||
let boundingBoxes = $state<Array<BoundingBox & { name?: string; face: Faces }>>([]);
|
||||
$effect(() => {
|
||||
if (assetViewerManager.isFaceEditMode || ocrManager.showOverlay) {
|
||||
return [];
|
||||
return;
|
||||
}
|
||||
|
||||
const knownBoxes = getBoundingBox(faces, overlaySize);
|
||||
@@ -186,7 +189,7 @@
|
||||
}));
|
||||
|
||||
if (assetViewerManager.highlightedFaces.length === 0) {
|
||||
return result;
|
||||
boundingBoxes = result;
|
||||
}
|
||||
|
||||
const knownIds = new Set(faces.map((f) => f.id));
|
||||
@@ -196,7 +199,7 @@
|
||||
result.push({ ...unassignedBoxes[i], face: unassignedFaces[i], name: undefined });
|
||||
}
|
||||
|
||||
return result;
|
||||
boundingBoxes = result;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user