From c20576ce64b97f8610ca1810bac94289ce87a61b Mon Sep 17 00:00:00 2001 From: laoluo Date: Wed, 8 Jun 2022 21:00:32 +0800 Subject: [PATCH] fix: TagTool doesn't need to rotate --- .../toolHeader/headerOption/index.tsx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/lb-components/src/views/MainView/toolHeader/headerOption/index.tsx b/packages/lb-components/src/views/MainView/toolHeader/headerOption/index.tsx index 526d5f0db..1a3b7ad48 100644 --- a/packages/lb-components/src/views/MainView/toolHeader/headerOption/index.tsx +++ b/packages/lb-components/src/views/MainView/toolHeader/headerOption/index.tsx @@ -14,6 +14,8 @@ import { EToolName } from '@/data/enums/ToolType'; import { ChangeSave } from '@/store/annotation/actionCreators'; import { IStepInfo } from '@/types/step'; import { useTranslation } from 'react-i18next'; +import { cTool } from '@labelbee/lb-annotation'; +const { EVideoToolName } = cTool; interface IProps { isBegin?: boolean; @@ -37,7 +39,10 @@ const HeaderOption: React.FC = (props) => { })); const { t } = useTranslation(); - const isBegin = props.isBegin || stepInfo?.tool === EToolName.Tag; + const isTagTool = [EToolName.Tag, EVideoToolName.VideoTagTool].includes(stepInfo?.tool as any); + const isVideo = [EVideoToolName.VideoTagTool].includes(stepInfo?.tool as any); + + const isBegin = props.isBegin || isTagTool; const updateRotate = () => { /** @@ -81,6 +86,10 @@ const HeaderOption: React.FC = (props) => { commonSvg: revocationSvg, selectedSvg: revocationHighlightSvg, click: () => { + if (isTagTool) { + return; + } + revocation(); }, style: { @@ -96,6 +105,10 @@ const HeaderOption: React.FC = (props) => { commonSvg: restoreSvg, selectedSvg: restoreHighlightSvg, click: () => { + if (isTagTool) { + return; + } + restore(); }, style: { @@ -111,9 +124,15 @@ const HeaderOption: React.FC = (props) => { selectedSvg: rotateHighlightSvg, commonSvg: rotateSvg, click: () => { + if (isVideo) { + // VideoTool don't need to rotate + return; + } + updateRotate(); }, style: { + opacity: isVideo === true ? 0.4 : 1, fontSize: '12px', color: !isBegin && toolHover === 'rotate' ? EColor.Hover : EColor.Normal, },