From 7d4d28d51c7bf49c92b05d9a9957fdb21471f72e Mon Sep 17 00:00:00 2001 From: lijingchi Date: Wed, 22 Mar 2023 19:08:00 +0800 Subject: [PATCH 1/7] fix(pointcloud): Fix attribute list hide attr fail --- .../src/components/pointCloudView/PointCloudContext.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lb-components/src/components/pointCloudView/PointCloudContext.tsx b/packages/lb-components/src/components/pointCloudView/PointCloudContext.tsx index 8a02d8cc4..8243d3c7d 100644 --- a/packages/lb-components/src/components/pointCloudView/PointCloudContext.tsx +++ b/packages/lb-components/src/components/pointCloudView/PointCloudContext.tsx @@ -177,7 +177,7 @@ export const PointCloudProvider: React.FC<{}> = ({ children }) => { _displayPointCloudList: IPointCloudBoxList = displayPointCloudList, _polygonList: IPolygonData[] = polygonList, ) => { - _displayPointCloudList.forEach((v) => { + pointCloudBoxList.forEach((v) => { mainViewInstance?.removeObjectByName(v.id); }); From d26691ec248fc940e63e53850fb2c0ba5ae42e17 Mon Sep 17 00:00:00 2001 From: lijingchi Date: Wed, 22 Mar 2023 19:23:04 +0800 Subject: [PATCH 2/7] fix(pointcloud): Update attr list style --- .../annotation/pointCloudTool/followTop.svg | 11 ------ .../pointCloudTool/followTopView.png | Bin 0 -> 1909 bytes packages/lb-components/src/index.scss | 8 +++-- .../toolFooter/AnnotatedAttributes/index.tsx | 34 ++++++++++++------ packages/lb-utils/src/i18n/resources.json | 6 ++-- 5 files changed, 32 insertions(+), 27 deletions(-) delete mode 100644 packages/lb-components/src/assets/annotation/pointCloudTool/followTop.svg create mode 100644 packages/lb-components/src/assets/annotation/pointCloudTool/followTopView.png diff --git a/packages/lb-components/src/assets/annotation/pointCloudTool/followTop.svg b/packages/lb-components/src/assets/annotation/pointCloudTool/followTop.svg deleted file mode 100644 index 9b76d10cf..000000000 --- a/packages/lb-components/src/assets/annotation/pointCloudTool/followTop.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/lb-components/src/assets/annotation/pointCloudTool/followTopView.png b/packages/lb-components/src/assets/annotation/pointCloudTool/followTopView.png new file mode 100644 index 0000000000000000000000000000000000000000..6b5cfef795879700e43546be3ed5b1968fddb868 GIT binary patch literal 1909 zcmV-*2a5QKP)5s#Kf3rMMeE)r0~Mxp^48fXJFG=Ne< zw*@qSl<-~UpuzFI*PiP+wzKm~)&=8hdw!oe?=em01$}*eKeV>C{{He~*UR?N1Z0V? z&(F`l9v>h7)$}jXf0{tDPkehJ{Kw{&mX_a4Alf%RqB)wInwowx0UGFPHUV1r7|2#c zAX^cEY()gJ6%oi*L?Bxcfow$tvK3J}vfsadZ+d!q%;(RaP1(?DN`}qNP4nr~Cv$y$ zZKkHCOqozR$%bgq*4AdqhM=<*5y)0VAX^cEY()gJ6%oi*MB)AHFJHcx_V)IQt4Ba% zV{UHF+}_?+d~QB(Zf;DG(bV7H|F)1-n~owy@!Vfb8>Q0*-lSS zP0>&ovXR>1;bAj6I+}{$YPh?*Gh16*71HnT?@bX<2(m{;M$E*-L@dc7t*8kIMQ}_(bAsanyyLWg5+C&SuE(TJ-eGyD)K!t2P0s$UJUapq_8?m>y_xd~c7tOo)fOoQy zYFmA5Z*Q9-fQN3Y6AkJ1PIgqPivmJ^`+kT#eZwo+__MZDXB9}quNrV%vaOUpFJnAwIF-B0A%NM?`kON5EaySTV8zTjQ51q{js1VS|CppK#mD-urx zC;Z*DkHi)N`+j}E8`%tAl1#3lF+`K8tEV>jJIA>Y4%xOU@!9<2jchwIySlnEX~DpW zIFl9lN2?qxU z6*tlcyctM)YPzTe*GSGKc#0NqwuHHm4QXiy&hfU-oD{aZ=d*=Pg>08Fn3+M5 zA!)Up^5R#Uo)*u2mW&j&n&q97)W|kl8}un{2O=9nGi-@r@!Y zqN61{7vq`+-pgXPE2dRgO$zOjoeJ3^-AGZi?=CN()_j!gYQa0%afMawwy!wYHbAQo ztgvjUMZn|ZW91&Sq#CHTpW(XM>V*755#Fqz**dJ+pN(|eNgkw% zym%H-Tax4vzWBz*#_R7qY$`kCuSu54k`i3hxONNM+TUhML;h*{Ki^mkLIrrD`8t z@nEl1Aab>ZK*;8t;_FL01)uiAj6*Ife32LiVh1M-5`wY{d};wQ#G z?z^6WFXUSpWU)VnhbfBpfd1ywHlPeJZ4_!7!&<3Yk>0q<5BDbfQ5|eax^xTw3Je*H zOi`O`du>co@Nghl`aj}=5iy|EDmQpAE@|HH^5rfx{? z@ILUZh3u@efu(z6Wfnj^;NxTHFtD<`IvTEL-9z%fCA(gW9J-i7v8-r7ha>H%j%v#X z#R$5-%%G63Evf}O88k33V9JE>_A^D4j%=CAc`e6o1f^3W@=mC;v$M=!1mhc}GmuDh z8KoKoovnyKwju)AiU?#YB9N_!K(-!I>!=s00000NkvXXu0mjf_1~2r literal 0 HcmV?d00001 diff --git a/packages/lb-components/src/index.scss b/packages/lb-components/src/index.scss index 7caf4a78e..116588536 100644 --- a/packages/lb-components/src/index.scss +++ b/packages/lb-components/src/index.scss @@ -763,7 +763,7 @@ $hotkey-container-padding: 7px; .svg { width: 80px; height: 100%; - color: #cccccc; + color: white; display: flex; justify-content: center; align-items: center; @@ -1283,7 +1283,8 @@ $hotkey-container-padding: 7px; cursor: pointer; } .anticon-eye, - .anticon-caret-down { + .anticon-caret-down, + .anticon-eye-invisible { margin-right: 8px; } @@ -1590,7 +1591,8 @@ $headerHeight: 40px; &__followTop { margin: 16px 0 0 0; - background-image: url('./assets/annotation/pointCloudTool/followTop.svg'); + background-size: 36px; + background-image: url('./assets/annotation/pointCloudTool/followTopView.png'); } &__top, diff --git a/packages/lb-components/src/views/MainView/toolFooter/AnnotatedAttributes/index.tsx b/packages/lb-components/src/views/MainView/toolFooter/AnnotatedAttributes/index.tsx index 4495e9183..284daf71e 100644 --- a/packages/lb-components/src/views/MainView/toolFooter/AnnotatedAttributes/index.tsx +++ b/packages/lb-components/src/views/MainView/toolFooter/AnnotatedAttributes/index.tsx @@ -22,6 +22,7 @@ import FooterPopover from '../FooterPopover'; const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => { const pointCloudCtx = useContext(PointCloudContext); + const { t } = useTranslation(); const { pointCloudBoxList, hideAttributes, @@ -50,6 +51,10 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => { return trackID ? trackID : order; }; + const getBoxKey = ({ trackID, order }: { trackID?: number; order?: number }) => { + return trackID ? `trackID_${trackID}` : `order_${order}`; + }; + const deleteGraphByAttr = (attribute: string) => { if (pointCloudListForSpecAttribute.length === 0) { return; @@ -57,11 +62,12 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => { const newPolygonList = polygonList.filter((i) => attribute !== i.attribute); const newPointCloudList = pointCloudBoxList.filter((i) => attribute !== i.attribute); - setPolygonList(newPolygonList); - setPointCloudResult(newPointCloudList); reRender(newPointCloudList, newPolygonList); + setPolygonList(newPolygonList); + setPointCloudResult(newPointCloudList); + pushHistoryWithList({ pointCloudBoxList: newPointCloudList, polygonList: newPolygonList }); }; @@ -85,7 +91,7 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => { )} { setExpanded(!expanded); }} @@ -94,13 +100,19 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => { onDeleteGraphByAttr(attribute)} /> - {pointCloudListForSpecAttribute.map((box) => { - return ( -
- {`${getBoxID(box)}.${attribute.key}`} -
- ); - })} + + {expanded && + (pointCloudListForSpecAttribute.length > 0 ? ( + pointCloudListForSpecAttribute.map((box) => { + return ( +
+ {`${getBoxID(box)}.${attribute.key}`} +
+ ); + }) + ) : ( +
{t('NoData')}
+ ))} ); }; @@ -114,7 +126,7 @@ export const AnnotatedAttributesPanel = () => {
{attrPanelLayout ? (
- 标注结果 + {t('AnnotatedResult')} { diff --git a/packages/lb-utils/src/i18n/resources.json b/packages/lb-utils/src/i18n/resources.json index f1f31c5bd..57d8faf13 100644 --- a/packages/lb-utils/src/i18n/resources.json +++ b/packages/lb-utils/src/i18n/resources.json @@ -196,7 +196,8 @@ "onDeleteGraphByAttr": "Are you sure to delete the data with attribute {{attribute}}?", "CancelFixed": "Cancel Fixed", "FixedOnLeft": "Fixed On Left", - "FixedOnRight": "Fixed On Right" + "FixedOnRight": "Fixed On Right", + "AnnotatedResult": "Annotated Result" }, "cn": { "TextInput": "文本输入", @@ -395,6 +396,7 @@ "onDeleteGraphByAttr": "确定要删除属性为 {{attribute}} 的标注数据吗?", "CancelFixed": "取消固定", "FixedOnLeft": "固定在左侧", - "FixedOnRight": "固定在右侧" + "FixedOnRight": "固定在右侧", + "AnnotatedResult": "标注结果" } } From 99e5642d435f62332434c81537ad5360f48e73cf Mon Sep 17 00:00:00 2001 From: lijingchi Date: Wed, 22 Mar 2023 20:00:15 +0800 Subject: [PATCH 3/7] fix(pointcloud): Init hideAttr while imgIndex changed --- packages/lb-annotation/src/core/pointCloud/index.ts | 5 +++-- .../src/components/pointCloudView/PointCloud3DView.tsx | 2 +- .../src/components/pointCloudView/PointCloudContext.tsx | 2 ++ .../src/components/pointCloudView/PointCloudListener.tsx | 4 ++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/lb-annotation/src/core/pointCloud/index.ts b/packages/lb-annotation/src/core/pointCloud/index.ts index af2e15656..798897148 100644 --- a/packages/lb-annotation/src/core/pointCloud/index.ts +++ b/packages/lb-annotation/src/core/pointCloud/index.ts @@ -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); } }; diff --git a/packages/lb-components/src/components/pointCloudView/PointCloud3DView.tsx b/packages/lb-components/src/components/pointCloudView/PointCloud3DView.tsx index 2354a4408..8a23f04ef 100644 --- a/packages/lb-components/src/components/pointCloudView/PointCloud3DView.tsx +++ b/packages/lb-components/src/components/pointCloudView/PointCloud3DView.tsx @@ -191,7 +191,7 @@ const PointCloud3D: React.FC = ({ currentData, config }) => { const ptCloud3DCtx = useMemo(() => { return { reset3DView, setTarget3DView, isActive: !!selectedBox, followTopView }; - }, [selectedBox]); + }, [selectedBox, ptCtx.mainViewInstance]); const PointCloud3DTitle = (
diff --git a/packages/lb-components/src/components/pointCloudView/PointCloudContext.tsx b/packages/lb-components/src/components/pointCloudView/PointCloudContext.tsx index 8243d3c7d..922325c38 100644 --- a/packages/lb-components/src/components/pointCloudView/PointCloudContext.tsx +++ b/packages/lb-components/src/components/pointCloudView/PointCloudContext.tsx @@ -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; @@ -81,6 +82,7 @@ export const PointCloudContext = React.createContext({ setZoom: () => {}, history: new ActionsHistory(), hideAttributes: [], + setHideAttributes: () => {}, toggleAttributesVisible: () => {}, reRender: () => {}, setAttrPanelLayout: () => {}, diff --git a/packages/lb-components/src/components/pointCloudView/PointCloudListener.tsx b/packages/lb-components/src/components/pointCloudView/PointCloudListener.tsx index a1d042930..8d37880d9 100644 --- a/packages/lb-components/src/components/pointCloudView/PointCloudListener.tsx +++ b/packages/lb-components/src/components/pointCloudView/PointCloudListener.tsx @@ -241,6 +241,10 @@ const PointCloudListener: React.FC = ({ updatePointCloudData?.(); }, [imgIndex, ptCtx.mainViewInstance]); + useEffect(() => { + ptCtx.setHideAttributes([]); + }, [imgIndex]); + // Update the listener of toolInstance. useEffect(() => { toolInstanceRef.current.exportData = () => { From 943c2b0dbb025c983352f12d16793b508b4c15ce Mon Sep 17 00:00:00 2001 From: laoluo Date: Thu, 23 Mar 2023 14:54:32 +0800 Subject: [PATCH 4/7] fix(view-operation): Update the range of direction judgement --- .../lb-annotation/src/core/toolOperation/ViewOperation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lb-annotation/src/core/toolOperation/ViewOperation.ts b/packages/lb-annotation/src/core/toolOperation/ViewOperation.ts index 3d9761d74..e5623c610 100644 --- a/packages/lb-annotation/src/core/toolOperation/ViewOperation.ts +++ b/packages/lb-annotation/src/core/toolOperation/ViewOperation.ts @@ -385,7 +385,7 @@ export default class ViewOperation extends BasicToolOperation { newPointList = DrawUtils.drawPolygon(this.canvas, renderLineWithZoom, lineRenderOptions); } - const isShowDirection = line?.showDirection === true && line?.pointList?.length > 2; + const isShowDirection = line?.showDirection === true && line?.pointList?.length >= 2; // 是否展示方向 if (isShowDirection) { @@ -460,7 +460,7 @@ export default class ViewOperation extends BasicToolOperation { newPointList = DrawUtils.drawPolygon(this.canvas, renderPolygon, polygonRenderOptions); } - const isShowDirection = polygon?.showDirection === true && polygon?.pointList?.length > 2; + const isShowDirection = polygon?.showDirection === true && polygon?.pointList?.length >= 2; // 是否展示方向 if (isShowDirection) { From dbd080f9e650d926be5729713b19217f36bcfc82 Mon Sep 17 00:00:00 2001 From: laoluo Date: Thu, 23 Mar 2023 15:04:23 +0800 Subject: [PATCH 5/7] chore: Update offical version --- packages/lb-annotation/package.json | 2 +- packages/lb-components/package.json | 4 ++-- packages/lb-demo/package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/lb-annotation/package.json b/packages/lb-annotation/package.json index 9a2780bdc..ae6e6c742 100644 --- a/packages/lb-annotation/package.json +++ b/packages/lb-annotation/package.json @@ -1,6 +1,6 @@ { "name": "@labelbee/lb-annotation", - "version": "1.12.0", + "version": "1.12.1", "description": "Annotation tool collection", "keywords": [ "annotation", diff --git a/packages/lb-components/package.json b/packages/lb-components/package.json index 0135f1cda..223359764 100644 --- a/packages/lb-components/package.json +++ b/packages/lb-components/package.json @@ -1,6 +1,6 @@ { "name": "@labelbee/lb-components", - "version": "1.8.0", + "version": "1.8.1", "description": "Provide a complete library of annotation components", "main": "./dist/index.js", "es": "./es/index.js", @@ -41,7 +41,7 @@ }, "dependencies": { "@ant-design/icons": "^4.6.2", - "@labelbee/lb-annotation": "^1.12.0", + "@labelbee/lb-annotation": "^1.12.1", "@labelbee/lb-utils": "^1.5.0", "ahooks": "^3.4.0", "classnames": "^2.3.0", diff --git a/packages/lb-demo/package.json b/packages/lb-demo/package.json index 1362eb5be..88fd806ca 100644 --- a/packages/lb-demo/package.json +++ b/packages/lb-demo/package.json @@ -3,8 +3,8 @@ "version": "1.9.0", "private": true, "dependencies": { - "@labelbee/lb-annotation": "^1.12.0", - "@labelbee/lb-components": "^1.8.0", + "@labelbee/lb-annotation": "^1.12.1", + "@labelbee/lb-components": "^1.8.1", "@labelbee/lb-utils": "^1.5.0", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", From 91e090e48fe82a99087f8a25c17aa481b830522a Mon Sep 17 00:00:00 2001 From: laoluo Date: Thu, 23 Mar 2023 15:09:22 +0800 Subject: [PATCH 6/7] chore(release): 1.12.1 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b21164913..5e156a7cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.12.1](https://github.com/open-mmlab/labelbee/compare/v1.12.0...v1.12.1) (2023-03-23) + + +### Bug Fixes + +* **view-operation:** Update the range of direction judgement ([943c2b0](https://github.com/open-mmlab/labelbee/commit/943c2b0dbb025c983352f12d16793b508b4c15ce)) + ## [1.12.0](https://github.com/open-mmlab/labelbee/compare/v1.11.0...v1.12.0) (2023-03-09) diff --git a/package.json b/package.json index 6ef81880c..7cb61bd1a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "labelbee", "private": true, - "version": "1.12.0", + "version": "1.12.1", "scripts": { "start": "lerna run build:type && lerna run --parallel --stream start", "start:quick": "lerna run --parallel --stream start", From e9187ef6810e0475ee96c00da542e74aca2c0110 Mon Sep 17 00:00:00 2001 From: laoluo Date: Thu, 23 Mar 2023 15:25:45 +0800 Subject: [PATCH 7/7] chore: Hide unused function --- .../src/components/Annotation/index.jsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/lb-demo/src/components/Annotation/index.jsx b/packages/lb-demo/src/components/Annotation/index.jsx index 58c2a5cd0..5c2f56324 100644 --- a/packages/lb-demo/src/components/Annotation/index.jsx +++ b/packages/lb-demo/src/components/Annotation/index.jsx @@ -57,26 +57,26 @@ const Annotation = (props) => { }; }; - const loadFileList = (page, pageSize) => { - return new Promise((resolve) => { - const fileList = []; - const total = 105; - for (let i = 0; i < pageSize; i++) { - if (page * pageSize + i >= total) { - break; - } - fileList.push({ - id: Number(`${page}${i}`), - result: '', - url: urlList[i % urlList.length], - }); - } - console.log('loadFileList', fileList); - setTimeout(() => { - resolve({ fileList, total }); - }, 500); - }); - }; + // const loadFileList = (page, pageSize) => { + // return new Promise((resolve) => { + // const fileList = []; + // const total = 105; + // for (let i = 0; i < pageSize; i++) { + // if (page * pageSize + i >= total) { + // break; + // } + // fileList.push({ + // id: Number(`${page}${i}`), + // result: '', + // url: urlList[i % urlList.length], + // }); + // } + // console.log('loadFileList', fileList); + // setTimeout(() => { + // resolve({ fileList, total }); + // }, 500); + // }); + // }; // const renderEnhance = { // staticRender: (canvas, rect, style) => {