Skip to content

Commit

Permalink
feat(pointcloud): ReRender 3dbox aftering changing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerwin-L committed Nov 23, 2022
1 parent 84c7ae7 commit f75d169
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const PointCloudListener: React.FC<IAnnotationStateProps> = ({ currentData }) =>
const { updateRotate } = useRotate({ currentData });
const { updatePointCloudData } = usePointCloudViews();
const { redo, undo, pushHistoryWithList } = useHistory();
const { syncThreeViewsAttribute, updateDefaultAttribute } = useAttribute();
const { syncThreeViewsAttribute, reRenderPointCloud3DBox } = useAttribute();

const keydownEvents = (lowerCaseKey: string, e: KeyboardEvent) => {
const { topViewInstance, mainViewInstance } = ptCtx;
Expand Down Expand Up @@ -183,9 +183,8 @@ const PointCloudListener: React.FC<IAnnotationStateProps> = ({ currentData }) =>

updateSelectedBox(selectBox);
syncThreeViewsAttribute(newAttribute);
reRenderPointCloud3DBox(selectBox);
}

updateDefaultAttribute(newAttribute);
};

toolInstanceRef.current.setSubAttribute = (key: string, value: string) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { IPointCloudBox } from '@labelbee/lb-utils';
import { useContext } from 'react';
import { PointCloudContext } from '../PointCloudContext';

export const useAttribute = () => {
const { topViewInstance, sideViewInstance, backViewInstance } = useContext(PointCloudContext);
const { topViewInstance, sideViewInstance, backViewInstance, mainViewInstance } = useContext(PointCloudContext);

const syncThreeViewsAttribute = (attribute?: string) => {
[
Expand All @@ -17,9 +18,15 @@ export const useAttribute = () => {
const updateDefaultAttribute = (attribute?: string) => {
topViewInstance?.pointCloud2dOperation.setDefaultAttribute(attribute);
};

const reRenderPointCloud3DBox = (newBox: IPointCloudBox) => {
mainViewInstance?.generateBox(newBox);
}


return {
syncThreeViewsAttribute,
updateDefaultAttribute,
reRenderPointCloud3DBox
};
};

0 comments on commit f75d169

Please sign in to comment.