Skip to content

Commit

Permalink
fix(pointcloud): Init hideAttr while imgIndex changed
Browse files Browse the repository at this point in the history
  • Loading branch information
lijingchi committed Mar 22, 2023
1 parent d26691e commit 99e5642
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/lb-annotation/src/core/pointCloud/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@ export class PointCloud {
}

if (camera) {
const cameraTar = this.getOrthographicCameraTarget(camera as OrthographicCamera);
this.updateCamera(camera.position, cameraTar);
const cameraTarget = this.getOrthographicCameraTarget(camera as OrthographicCamera);
this.camera.zoom = camera.zoom;
this.updateCamera(camera.position, cameraTarget);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const PointCloud3D: React.FC<IA2MapStateProps> = ({ currentData, config }) => {

const ptCloud3DCtx = useMemo(() => {
return { reset3DView, setTarget3DView, isActive: !!selectedBox, followTopView };
}, [selectedBox]);
}, [selectedBox, ptCtx.mainViewInstance]);

const PointCloud3DTitle = (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface IPointCloudContext extends IPointCloudContextInstances {

history: ActionsHistory; // Operation History
hideAttributes: string[];
setHideAttributes: (hideAttrs: string[]) => void;
toggleAttributesVisible: (attribute: string) => void;
reRender: (_displayPointCloudList: IPointCloudBoxList, _polygonList: IPolygonData[]) => void;
attrPanelLayout: AttrPanelLayout;
Expand Down Expand Up @@ -81,6 +82,7 @@ export const PointCloudContext = React.createContext<IPointCloudContext>({
setZoom: () => {},
history: new ActionsHistory(),
hideAttributes: [],
setHideAttributes: () => {},
toggleAttributesVisible: () => {},
reRender: () => {},
setAttrPanelLayout: () => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ const PointCloudListener: React.FC<IProps> = ({
updatePointCloudData?.();
}, [imgIndex, ptCtx.mainViewInstance]);

useEffect(() => {
ptCtx.setHideAttributes([]);
}, [imgIndex]);

// Update the listener of toolInstance.
useEffect(() => {
toolInstanceRef.current.exportData = () => {
Expand Down

0 comments on commit 99e5642

Please sign in to comment.