diff --git a/packages/lb-annotation/src/core/pointCloud/index.ts b/packages/lb-annotation/src/core/pointCloud/index.ts index 5d7d2dcf..e11da6e2 100644 --- a/packages/lb-annotation/src/core/pointCloud/index.ts +++ b/packages/lb-annotation/src/core/pointCloud/index.ts @@ -275,7 +275,6 @@ export class PointCloud extends EventListener { this.updateMaterialColor(grandson, color); }); }); - this.render(); } private updateMaterialColor(child: THREE.Object3D, color: THREE.ColorRepresentation) { diff --git a/packages/lb-components/src/components/pointCloudView/PointCloud3DView.tsx b/packages/lb-components/src/components/pointCloudView/PointCloud3DView.tsx index 8c780b68..ae3a0e81 100644 --- a/packages/lb-components/src/components/pointCloudView/PointCloud3DView.tsx +++ b/packages/lb-components/src/components/pointCloudView/PointCloud3DView.tsx @@ -252,9 +252,9 @@ const PointCloud3D: React.FC = ({ currentData, config, highlig ptCtx.mainViewInstance?.updateCameraZoom(zoom); } // when create new box, need to wait for a moment to init box. - setTimeout(() => { - ptCtx.mainViewInstance?.setHighlightColor(selectedId); - }, 100); + ptCtx.mainViewInstance?.setHighlightColor(selectedId); + ptCtx.mainViewInstance?.render(); + }, [selectedBox?.info?.id]); useEffect(() => { diff --git a/packages/lb-components/src/components/pointCloudView/PointCloudListener.tsx b/packages/lb-components/src/components/pointCloudView/PointCloudListener.tsx index 08825aa1..7ab0e4a9 100644 --- a/packages/lb-components/src/components/pointCloudView/PointCloudListener.tsx +++ b/packages/lb-components/src/components/pointCloudView/PointCloudListener.tsx @@ -323,6 +323,7 @@ const PointCloudListener: React.FC = ({ if (ptCtx.mainViewInstance && ptCtx.selectedPointCloudBox) { ptCtx.mainViewInstance.generateBox(ptCtx.selectedPointCloudBox); ptCtx.mainViewInstance.setHighlightColor(selectBox.id); + ptCtx.mainViewInstance.render(); } } }; diff --git a/packages/lb-components/src/components/pointCloudView/hooks/usePointCloudViews.ts b/packages/lb-components/src/components/pointCloudView/hooks/usePointCloudViews.ts index 2b366dd4..870e830f 100644 --- a/packages/lb-components/src/components/pointCloudView/hooks/usePointCloudViews.ts +++ b/packages/lb-components/src/components/pointCloudView/hooks/usePointCloudViews.ts @@ -581,6 +581,7 @@ export const synchronizeTopView = ( // Control the 3D view data to create box mainViewInstance.generateBox(newBoxParams); + mainViewInstance.setHighlightColor(newBoxParams.id); mainViewInstance.render(); const { pointCloud2dOperation, pointCloudInstance } = topViewInstance; diff --git a/packages/lb-components/src/components/pointCloudView/hooks/useUpdatePointCloudColor.ts b/packages/lb-components/src/components/pointCloudView/hooks/useUpdatePointCloudColor.ts index 3dbb5229..260f187e 100644 --- a/packages/lb-components/src/components/pointCloudView/hooks/useUpdatePointCloudColor.ts +++ b/packages/lb-components/src/components/pointCloudView/hooks/useUpdatePointCloudColor.ts @@ -136,6 +136,7 @@ const useUpdatePointCloudColor = (setResourceLoading: any, config: any) => { mainViewInstance.generateBoxes(pointCloudBoxList); if (newSelectedBox) { mainViewInstance.setHighlightColor(newSelectedBox.id); + mainViewInstance.render(); } }