From 1ebb67011da5d6f14c9cb758e3ebfa4186ec45b7 Mon Sep 17 00:00:00 2001 From: luozefeng Date: Tue, 28 Sep 2021 18:46:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9F=A5=E7=9C=8B=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=82=E9=85=8D=20label-bee?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/core/toolOperation/checkOperation.ts | 10 +++++++- packages/lb-components/src/index.scss | 1 + .../src/store/annotation/reducer.ts | 24 ++++++++++++------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/packages/lb-annotation/src/core/toolOperation/checkOperation.ts b/packages/lb-annotation/src/core/toolOperation/checkOperation.ts index 832d0660e..21e2984fa 100644 --- a/packages/lb-annotation/src/core/toolOperation/checkOperation.ts +++ b/packages/lb-annotation/src/core/toolOperation/checkOperation.ts @@ -1,6 +1,6 @@ +import { cloneDeep } from 'lodash'; import CommonToolUtils from '@/utils/tool/CommonToolUtils'; import TagUtils from '@/utils/tool/TagUtils'; -import { cloneDeep } from 'lodash'; import { DEFAULT_TEXT_OFFSET } from '../../constant/annotation'; import { EToolName } from '../../constant/tool'; import { IPolygonData } from '../../types/tool/polygon'; @@ -9,6 +9,7 @@ import AxisUtils from '../../utils/tool/AxisUtils'; import DrawUtils from '../../utils/tool/DrawUtils'; import StyleUtils from '../../utils/tool/StyleUtils'; import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation'; + const TEXT_ATTRIBUTE_OFFSET = { x: 8, y: 26, @@ -150,6 +151,13 @@ class CheckOperation extends BasicToolOperation { } }); } + + /** + * 同步操作中的基础信息 + */ + public exportData() { + return [[], {}]; + } } export default CheckOperation; diff --git a/packages/lb-components/src/index.scss b/packages/lb-components/src/index.scss index 533941173..f79889c71 100644 --- a/packages/lb-components/src/index.scss +++ b/packages/lb-components/src/index.scss @@ -42,6 +42,7 @@ $prefix: bee; background: rgba(68, 68, 68, 1); cursor: default; font-size: 14px; + overflow: hidden; &__pagination { display: flex; diff --git a/packages/lb-components/src/store/annotation/reducer.ts b/packages/lb-components/src/store/annotation/reducer.ts index b02399eb8..548cdd032 100644 --- a/packages/lb-components/src/store/annotation/reducer.ts +++ b/packages/lb-components/src/store/annotation/reducer.ts @@ -10,6 +10,7 @@ import { getFormatSize } from '@/components/customResizeHook'; import { AnnotationEngine } from '@sensetime/annotation'; import { AnnotationState, AnnotationActionTypes } from './types'; import { message } from 'antd'; +import { EToolName } from '@/data/enums/ToolType'; const getStepConfig = (stepList: any[], step: number) => stepList.find((i) => i.step === step); @@ -80,9 +81,9 @@ export const loadFileData = type: ANNOTATION_ACTIONS.SET_LOADING, payload: { loading: true, - } - }) - + }, + }); + /** 支持外部传入获取文件接口 */ if (getFileData) { const fileData = await getFileData(imgList[nextIndex], nextIndex); @@ -108,9 +109,9 @@ export const loadFileData = type: ANNOTATION_ACTIONS.SET_LOADING, payload: { loading: false, - } - }) - + }, + }); + dispatch({ type: ANNOTATION_ACTIONS.LOAD_FILE_DATA, payload: { @@ -266,6 +267,8 @@ export const annotationReducer = ( return state; } + const currentStepInfo = StepUtils.getCurrentStepInfo(step, stepList); + const { nextIndex, imgNode, nextBasicIndex } = action.payload; const basicIndex = nextBasicIndex ?? 0; @@ -306,8 +309,11 @@ export const annotationReducer = ( } } - toolInstance.setResult(result, isInitData); - toolInstance.history.initRecord(result, true); + // TODO,非查看模式才允许添加数据 + if (currentStepInfo.tool !== 'check') { + toolInstance.setResult(result, isInitData); + toolInstance.history.initRecord(result, true); + } return { ...state, @@ -440,7 +446,7 @@ export const annotationReducer = ( return { ...state, loading: !!loading, - } + }; } // eslint-disable-next-line no-fallthrough