From 4dbfff505bfd30881ef03ba18d74c5905c286b02 Mon Sep 17 00:00:00 2001 From: laoluo Date: Sun, 28 Aug 2022 20:30:10 +0800 Subject: [PATCH] feat(pointcloud): Switch PointCloud needs to change side&back view --- .../src/core/toolOperation/pointCloud2dOperation.ts | 2 ++ .../src/components/pointCloudView/hooks/useSingleBox.tsx | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/lb-annotation/src/core/toolOperation/pointCloud2dOperation.ts b/packages/lb-annotation/src/core/toolOperation/pointCloud2dOperation.ts index cf98682be..0b966aa13 100644 --- a/packages/lb-annotation/src/core/toolOperation/pointCloud2dOperation.ts +++ b/packages/lb-annotation/src/core/toolOperation/pointCloud2dOperation.ts @@ -224,6 +224,8 @@ class PointCloud2dOperation extends PolygonOperation { this.setSelectedIDs([nextSelectedResult.id]); } this.render(); + + return [nextSelectedResult.id]; } /** diff --git a/packages/lb-components/src/components/pointCloudView/hooks/useSingleBox.tsx b/packages/lb-components/src/components/pointCloudView/hooks/useSingleBox.tsx index edce1b7e3..02ed2332c 100644 --- a/packages/lb-components/src/components/pointCloudView/hooks/useSingleBox.tsx +++ b/packages/lb-components/src/components/pointCloudView/hooks/useSingleBox.tsx @@ -15,6 +15,7 @@ export const useSingleBox = () => { selectedIDs, selectedID, mainViewInstance, + setSelectedIDs, } = useContext(PointCloudContext); /** Returns { info: selected box, index: selected box index } */ @@ -52,7 +53,8 @@ export const useSingleBox = () => { const { pointCloud2dOperation } = topViewInstance; - pointCloud2dOperation.switchToNextPolygon(sort); + const newSelectedIDs = pointCloud2dOperation.switchToNextPolygon(sort); + setSelectedIDs(newSelectedIDs); }, [topViewInstance], );