Skip to content

Commit

Permalink
feat(pointcloud): Confirm before deleteGraphByAttr
Browse files Browse the repository at this point in the history
  • Loading branch information
lijingchi committed Mar 20, 2023
1 parent 753a7b2 commit e8759ac
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const PointCloudProvider: React.FC<{}> = ({ children }) => {

topViewInstance?.updatePolygonList(_displayPointCloudList, _polygonList);
mainViewInstance?.generateBoxes(_displayPointCloudList);
syncAllViewPointCloudColor(_displayPointCloudList);
};

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/lb-components/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,10 @@ $hotkey-container-padding: 7px;
&__text {
display: flex;
justify-content: space-between;
padding: 8px 20px;
padding: 8px 12px;
color: #333;
}

&__item {
height: 40px;
line-height: 40px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PointCloudContext } from '@/components/pointCloudView/PointCloudContext';
import { Popover } from 'antd';
import { Modal, Popover } from 'antd';
import React, { useContext, useState } from 'react';
import { stepConfigSelector } from '@/store/annotation/selectors';
import { useSelector } from '@/store/ctx';
import { IPointCloudConfig } from '@labelbee/lb-utils';
import { i18n, IPointCloudConfig } from '@labelbee/lb-utils';
import {
CaretDownFilled,
DeleteOutlined,
Expand Down Expand Up @@ -65,6 +65,17 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => {
pushHistoryWithList({ pointCloudBoxList: newPointCloudList, polygonList: newPolygonList });
};

const onDeleteGraphByAttr = (attribute: IInputList) => {
Modal.confirm({
content: i18n.t('onDeleteGraphByAttr', { attribute: attribute.key }),
onOk: () => {
deleteGraphByAttr(attribute.value);
},
okText: i18n.t('Confirm'),
cancelText: i18n.t('Cancel'),
});
};

return (
<>
<div className={getClassName('annotated-attribute', 'item')}>
Expand All @@ -81,7 +92,7 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => {
/>
<span className={getClassName('annotated-attribute', 'item', 'text')}>{attribute.key}</span>

<DeleteOutlined onClick={() => deleteGraphByAttr(attribute.value)} />
<DeleteOutlined onClick={() => onDeleteGraphByAttr(attribute)} />
</div>
{pointCloudListForSpecAttribute.map((box) => {
return (
Expand Down Expand Up @@ -188,4 +199,17 @@ export const AnnotatedAttributesIcon = () => {
content={<AnnotatedAttributesPanel />}
/>
);

return (
<Popover
placement='topLeft'
content={<AnnotatedAttributesPanel />}
overlayClassName={getClassName('annotated-attribute', 'popover')}
>
<span>
<UnorderedListOutlined style={{ marginRight: 4 }} />
{t('AnnotatedList')}
</span>
</Popover>
);
};
8 changes: 5 additions & 3 deletions packages/lb-utils/src/i18n/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"AnnotateInvalidPolygon": "Annotate Invalid Polygon",
"TogglePolygonEffectiveness": "Toggle Polygon Validity",
"DeletePolygon": "Delete Polygon",
"Delete": "Delete",
"Delete": "Delete",
"TogglePointParticularity": "Toggle Point Particularity",
"CropOverlapArea": "Crop Overlap Area",
"SegmentationRecognition": "Segmentation Recognition",
Expand Down Expand Up @@ -192,7 +192,8 @@
"UnifySize": "Unify Size",
"UnifyTag": "Unify Tag",
"NoData": "No Data",
"AnnotatedList": "Annotated List"
"AnnotatedList": "Annotated List",
"onDeleteGraphByAttr": "Are you sure to delete the data with attribute {{attribute}}?"
},
"cn": {
"TextInput": "文本输入",
Expand Down Expand Up @@ -387,6 +388,7 @@
"UnifySize": "统一尺寸",
"UnifyTag": "统一标签",
"NoData": "暂无数据",
"AnnotatedList": "标注列表"
"AnnotatedList": "标注列表",
"onDeleteGraphByAttr": "确定要删除属性为 {{attribute}} 的标注数据吗?"
}
}

0 comments on commit e8759ac

Please sign in to comment.