Skip to content

Commit

Permalink
Merge pull request #270 from open-mmlab/fix/pointCloud-highlight
Browse files Browse the repository at this point in the history
Fix/point cloud highlight
  • Loading branch information
Glenfiddish authored Aug 15, 2023
2 parents 686865d + 6e93c21 commit 0d99c3a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/lb-annotation/src/core/pointCloud/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ export class PointCloud extends EventListener {
gl_FragColor = vec4(color, 1.0);
}`,
uniforms: {
pointSize: { value: 1.2 }, // Init size.
pointSize: { value: this.pointsMaterialSize }, // Init size.
},
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const HighlightVisible = ({
borderRadius: 2,
padding: 6,
fontSize: 16,
zIndex: 1001,
zIndex: 101,
};
let ShowIcon = visible ? EyeFilled : EyeInvisibleFilled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1201,8 +1201,29 @@ export const usePointCloudViews = () => {

let boxParamsList: any[] = [];
let lineList: any[] = [];
let polygonList = [];
let polygonList: any[] = [];
let sphereParamsList: IPointCloudSphere[] = [];

mainViewInstance.updateTopCamera();

const valid = jsonParser(newData.result)?.valid ?? true;
ptCtx.setPointCloudValid(valid);

// Clear other view data during initialization
ptCtx.sideViewInstance?.clearAllData();
ptCtx.backViewInstance?.clearAllData();

// TopView Data Update
/**
* Listen to flip
* 1. Init
* 2. Reload PointCloud
* 3. Clear Polygon
*/
topViewInstance.updateData(newData.url, newData.result, {
radius: config?.radius ?? DEFAULT_RADIUS,
});

if (newData.result) {
boxParamsList = PointCloudUtils.getBoxParamsFromResultList(newData.result);
polygonList = PointCloudUtils.getPolygonListFromResultList(newData.result);
Expand All @@ -1215,8 +1236,9 @@ export const usePointCloudViews = () => {

/**
* Use [] to replace the default highlight2DDataList.
* Need to await syncAllViewPointCloudColor before setLoading(false).
*/
ptCtx.syncAllViewPointCloudColor(boxParamsList, []);
await ptCtx.syncAllViewPointCloudColor(boxParamsList, []);
}

initHistory({
Expand All @@ -1226,25 +1248,6 @@ export const usePointCloudViews = () => {
pointCloudSphereList: sphereParamsList,
});

mainViewInstance.updateTopCamera();

const valid = jsonParser(newData.result)?.valid ?? true;
ptCtx.setPointCloudValid(valid);

// Clear other view data during initialization
ptCtx.sideViewInstance?.clearAllData();
ptCtx.backViewInstance?.clearAllData();

// TopView Data Update
/**
* Listen to flip
* 1. Init
* 2. Reload PointCloud
* 3. Clear Polygon
*/
topViewInstance.updateData(newData.url, newData.result, {
radius: config?.radius ?? DEFAULT_RADIUS,
});
SetPointCloudLoading(dispatch, false);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/lb-components/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ $headerHeight: 40px;
}
&__slider {
width: 70px;
padding: 0 4px;
padding: 0 4px 0 8px;
}
}

Expand Down
10 changes: 9 additions & 1 deletion packages/lb-components/src/views/MainView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import PreviewResult from '@/components/predictTracking/previewResult';
import { LabelBeeContext } from '@/store/ctx';
import { EToolName } from '@/data/enums/ToolType';
import LLMLayout from './LLMLayout';
import { LoadingOutlined } from '@ant-design/icons';
import { useTranslation } from 'react-i18next';

interface IProps {
path: string;
Expand Down Expand Up @@ -74,11 +76,17 @@ const AnnotatedArea: React.FC<AppProps & IProps> = (props) => {
};

const ViewportProviderLayout = (props: AppProps & IProps & { children: any }) => {
const { t } = useTranslation();
const { stepList, step } = props;
const currentToolName = getStepConfig(stepList, step)?.tool;
return (
<ViewportProvider>
<Spin spinning={props.loading}>
<Spin
spinning={props.loading}
indicator={<LoadingOutlined />}
tip={<span style={{ marginTop: 200 }}>{t('LoadingTips')}</span>}
delay={500}
>
<Layout className={classnames([layoutCls, props.className])} style={props.style?.layout}>
<header className={`${layoutCls}__header`} style={props.style?.header}>
<ToolHeader
Expand Down
2 changes: 2 additions & 0 deletions packages/lb-utils/src/i18n/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
"DefaultSize":"Click to use the default size.",
"NormalSizeRange":"Normal size range",
"NormalCenterPointRange":"Normal center point range",
"LoadingTips": "Wait a minute, Data Loading ~",
"Unlocked":"Unlocked",
"Locked":"Locked"
},
Expand Down Expand Up @@ -494,6 +495,7 @@
"DefaultSize":"点击图标以使用默认尺寸",
"NormalSizeRange":"正常尺寸范围",
"NormalCenterPointRange":"正常中心点范围",
"LoadingTips": "数据加载中~请稍后",
"Unlocked":"未开启",
"Locked":"已开启"
}
Expand Down

0 comments on commit 0d99c3a

Please sign in to comment.