Skip to content

Commit

Permalink
feat: 查看工具支持适配 label-bee
Browse files Browse the repository at this point in the history
  • Loading branch information
luozefeng committed Sep 28, 2021
1 parent af51252 commit 1ebb670
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
10 changes: 9 additions & 1 deletion packages/lb-annotation/src/core/toolOperation/checkOperation.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -150,6 +151,13 @@ class CheckOperation extends BasicToolOperation {
}
});
}

/**
* 同步操作中的基础信息
*/
public exportData() {
return [[], {}];
}
}

export default CheckOperation;
1 change: 1 addition & 0 deletions packages/lb-components/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $prefix: bee;
background: rgba(68, 68, 68, 1);
cursor: default;
font-size: 14px;
overflow: hidden;

&__pagination {
display: flex;
Expand Down
24 changes: 15 additions & 9 deletions packages/lb-components/src/store/annotation/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -80,9 +81,9 @@ export const loadFileData =
type: ANNOTATION_ACTIONS.SET_LOADING,
payload: {
loading: true,
}
})
},
});

/** 支持外部传入获取文件接口 */
if (getFileData) {
const fileData = await getFileData(imgList[nextIndex], nextIndex);
Expand All @@ -108,9 +109,9 @@ export const loadFileData =
type: ANNOTATION_ACTIONS.SET_LOADING,
payload: {
loading: false,
}
})
},
});

dispatch({
type: ANNOTATION_ACTIONS.LOAD_FILE_DATA,
payload: {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -440,7 +446,7 @@ export const annotationReducer = (
return {
...state,
loading: !!loading,
}
};
}

// eslint-disable-next-line no-fallthrough
Expand Down

0 comments on commit 1ebb670

Please sign in to comment.