未验证 提交 5bb26ce6 编写于 作者: B Boris Sekachev 提交者: GitHub

Some JS code was simplified by using css, a reported issue was fixed in this way (#3289)

* Some JS code was simplified by using css

* Updated version & changelog

* Fixed shortcut
上级 8d05691f
...@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Incorrect attribute import in tracks (<https://github.com/openvinotoolkit/cvat/pull/3229>) - Incorrect attribute import in tracks (<https://github.com/openvinotoolkit/cvat/pull/3229>)
- Issue "is not a constructor" when create object, save, undo, save, redo save (<https://github.com/openvinotoolkit/cvat/pull/3292>) - Issue "is not a constructor" when create object, save, undo, save, redo save (<https://github.com/openvinotoolkit/cvat/pull/3292>)
- Fix CLI create an infinite loop if git repository responds with failure (<https://github.com/openvinotoolkit/cvat/pull/3267>) - Fix CLI create an infinite loop if git repository responds with failure (<https://github.com/openvinotoolkit/cvat/pull/3267>)
- Bug with sidebar & fullscreen (<https://github.com/openvinotoolkit/cvat/pull/3289>)
### Security ### Security
......
{ {
"name": "cvat-ui", "name": "cvat-ui",
"version": "1.20.2", "version": "1.20.3",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
{ {
"name": "cvat-ui", "name": "cvat-ui",
"version": "1.20.2", "version": "1.20.3",
"description": "CVAT single-page application", "description": "CVAT single-page application",
"main": "src/index.tsx", "main": "src/index.tsx",
"scripts": { "scripts": {
......
...@@ -146,7 +146,6 @@ export enum AnnotationActionTypes { ...@@ -146,7 +146,6 @@ export enum AnnotationActionTypes {
GROUP_ANNOTATIONS_FAILED = 'GROUP_ANNOTATIONS_FAILED', GROUP_ANNOTATIONS_FAILED = 'GROUP_ANNOTATIONS_FAILED',
SPLIT_ANNOTATIONS_SUCCESS = 'SPLIT_ANNOTATIONS_SUCCESS', SPLIT_ANNOTATIONS_SUCCESS = 'SPLIT_ANNOTATIONS_SUCCESS',
SPLIT_ANNOTATIONS_FAILED = 'SPLIT_ANNOTATIONS_FAILED', SPLIT_ANNOTATIONS_FAILED = 'SPLIT_ANNOTATIONS_FAILED',
UPDATE_TAB_CONTENT_HEIGHT = 'UPDATE_TAB_CONTENT_HEIGHT',
COLLAPSE_SIDEBAR = 'COLLAPSE_SIDEBAR', COLLAPSE_SIDEBAR = 'COLLAPSE_SIDEBAR',
COLLAPSE_APPEARANCE = 'COLLAPSE_APPEARANCE', COLLAPSE_APPEARANCE = 'COLLAPSE_APPEARANCE',
COLLAPSE_OBJECT_ITEMS = 'COLLAPSE_OBJECT_ITEMS', COLLAPSE_OBJECT_ITEMS = 'COLLAPSE_OBJECT_ITEMS',
...@@ -576,15 +575,6 @@ export function activateObject(activatedStateID: number | null, activatedAttribu ...@@ -576,15 +575,6 @@ export function activateObject(activatedStateID: number | null, activatedAttribu
}; };
} }
export function updateTabContentHeight(tabContentHeight: number): AnyAction {
return {
type: AnnotationActionTypes.UPDATE_TAB_CONTENT_HEIGHT,
payload: {
tabContentHeight,
},
};
}
export function collapseSidebar(): AnyAction { export function collapseSidebar(): AnyAction {
return { return {
type: AnnotationActionTypes.COLLAPSE_SIDEBAR, type: AnnotationActionTypes.COLLAPSE_SIDEBAR,
......
...@@ -15,10 +15,7 @@ import Button from 'antd/lib/button'; ...@@ -15,10 +15,7 @@ import Button from 'antd/lib/button';
import ColorPicker from 'components/annotation-page/standard-workspace/objects-side-bar/color-picker'; import ColorPicker from 'components/annotation-page/standard-workspace/objects-side-bar/color-picker';
import { ColorizeIcon } from 'icons'; import { ColorizeIcon } from 'icons';
import { ColorBy, CombinedState, DimensionType } from 'reducers/interfaces'; import { ColorBy, CombinedState, DimensionType } from 'reducers/interfaces';
import { import { collapseAppearance as collapseAppearanceAction } from 'actions/annotation-actions';
collapseAppearance as collapseAppearanceAction,
updateTabContentHeight as updateTabContentHeightAction,
} from 'actions/annotation-actions';
import { import {
changeShapesColorBy as changeShapesColorByAction, changeShapesColorBy as changeShapesColorByAction,
changeShapesOpacity as changeShapesOpacityAction, changeShapesOpacity as changeShapesOpacityAction,
...@@ -50,21 +47,6 @@ interface DispatchToProps { ...@@ -50,21 +47,6 @@ interface DispatchToProps {
changeShowProjections(event: CheckboxChangeEvent): void; changeShowProjections(event: CheckboxChangeEvent): void;
} }
export function computeHeight(): number {
const [sidebar] = window.document.getElementsByClassName('cvat-objects-sidebar');
const [appearance] = window.document.getElementsByClassName('cvat-objects-appearance-collapse');
const [tabs] = Array.from(window.document.querySelectorAll('.cvat-objects-sidebar-tabs > .ant-tabs-nav'));
if (sidebar && appearance && tabs) {
const maxHeight = sidebar ? sidebar.clientHeight : 0;
const appearanceHeight = appearance ? appearance.clientHeight : 0;
const tabsHeight = tabs ? tabs.clientHeight : 0;
return maxHeight - appearanceHeight - tabsHeight;
}
return 0;
}
function mapStateToProps(state: CombinedState): StateToProps { function mapStateToProps(state: CombinedState): StateToProps {
const { const {
annotation: { annotation: {
...@@ -95,19 +77,6 @@ function mapDispatchToProps(dispatch: Dispatch<AnyAction>): DispatchToProps { ...@@ -95,19 +77,6 @@ function mapDispatchToProps(dispatch: Dispatch<AnyAction>): DispatchToProps {
return { return {
collapseAppearance(): void { collapseAppearance(): void {
dispatch(collapseAppearanceAction()); dispatch(collapseAppearanceAction());
const [collapser] = window.document.getElementsByClassName('cvat-objects-appearance-collapse');
if (collapser) {
const listener = (event: Event): void => {
if ((event as TransitionEvent).propertyName === 'height') {
const height = computeHeight();
dispatch(updateTabContentHeightAction(height));
collapser.removeEventListener('transitionend', listener);
}
};
collapser.addEventListener('transitionend', listener);
}
}, },
changeShapesColorBy(event: RadioChangeEvent): void { changeShapesColorBy(event: RadioChangeEvent): void {
dispatch(changeShapesColorByAction(event.target.value)); dispatch(changeShapesColorByAction(event.target.value));
......
...@@ -10,6 +10,7 @@ import Layout, { SiderProps } from 'antd/lib/layout'; ...@@ -10,6 +10,7 @@ import Layout, { SiderProps } from 'antd/lib/layout';
import Text from 'antd/lib/typography/Text'; import Text from 'antd/lib/typography/Text';
import { Canvas } from 'cvat-canvas-wrapper'; import { Canvas } from 'cvat-canvas-wrapper';
import { Canvas3d } from 'cvat-canvas3d-wrapper';
import { LogType } from 'cvat-logger'; import { LogType } from 'cvat-logger';
import { import {
activateObject as activateObjectAction, activateObject as activateObjectAction,
...@@ -20,6 +21,7 @@ import GlobalHotKeys, { KeyMap } from 'utils/mousetrap-react'; ...@@ -20,6 +21,7 @@ import GlobalHotKeys, { KeyMap } from 'utils/mousetrap-react';
import { ThunkDispatch } from 'utils/redux'; import { ThunkDispatch } from 'utils/redux';
import AppearanceBlock from 'components/annotation-page/appearance-block'; import AppearanceBlock from 'components/annotation-page/appearance-block';
import ObjectButtonsContainer from 'containers/annotation-page/standard-workspace/objects-side-bar/object-buttons'; import ObjectButtonsContainer from 'containers/annotation-page/standard-workspace/objects-side-bar/object-buttons';
import { adjustContextImagePosition } from 'components/annotation-page/standard-workspace/context-image/context-image';
import { CombinedState, ObjectType } from 'reducers/interfaces'; import { CombinedState, ObjectType } from 'reducers/interfaces';
import AttributeEditor from './attribute-editor'; import AttributeEditor from './attribute-editor';
import AttributeSwitcher from './attribute-switcher'; import AttributeSwitcher from './attribute-switcher';
...@@ -34,7 +36,7 @@ interface StateToProps { ...@@ -34,7 +36,7 @@ interface StateToProps {
jobInstance: any; jobInstance: any;
keyMap: KeyMap; keyMap: KeyMap;
normalizedKeyMap: Record<string, string>; normalizedKeyMap: Record<string, string>;
canvasInstance: Canvas; canvasInstance: Canvas | Canvas3d;
canvasIsReady: boolean; canvasIsReady: boolean;
curZLayer: number; curZLayer: number;
} }
...@@ -134,6 +136,7 @@ function AttributeAnnotationSidebar(props: StateToProps & DispatchToProps): JSX. ...@@ -134,6 +136,7 @@ function AttributeAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.
(collapser as HTMLElement).addEventListener('transitionend', listener as any); (collapser as HTMLElement).addEventListener('transitionend', listener as any);
} }
adjustContextImagePosition(!sidebarCollapsed);
setSidebarCollapsed(!sidebarCollapsed); setSidebarCollapsed(!sidebarCollapsed);
}; };
......
...@@ -255,7 +255,7 @@ function AttributeEditor(props: Props): JSX.Element { ...@@ -255,7 +255,7 @@ function AttributeEditor(props: Props): JSX.Element {
const { inputType, values, id: attrID } = attribute; const { inputType, values, id: attrID } = attribute;
return ( return (
<div> <div className='attribute-annotations-sidebar-attribute-editor'>
{renderList({ values, inputType, onChange })} {renderList({ values, inputType, onChange })}
<hr /> <hr />
{renderInputElement({ {renderInputElement({
......
...@@ -8,9 +8,14 @@ ...@@ -8,9 +8,14 @@
height: 100%; height: 100%;
} }
.attribute-annotation-sidebar { .attribute-annotation-sidebar:not(.ant-layout-sider-collapsed) {
background: $background-color-2; background: $background-color-2;
padding: 5px; padding: 5px;
> .ant-layout-sider-children {
display: flex;
flex-direction: column;
}
} }
.cvat-attribute-annotation-sidebar-object-switcher, .cvat-attribute-annotation-sidebar-object-switcher,
...@@ -43,6 +48,11 @@ ...@@ -43,6 +48,11 @@
.attribute-annotations-sidebar-not-found-wrapper { .attribute-annotations-sidebar-not-found-wrapper {
margin-top: 20px; margin-top: 20px;
text-align: center; text-align: center;
flex-grow: 10;
}
.attribute-annotations-sidebar-attribute-editor {
flex-grow: 10;
} }
.attribute-annotation-sidebar-attr-list-wrapper { .attribute-annotation-sidebar-attr-list-wrapper {
......
...@@ -13,6 +13,19 @@ import { CombinedState } from 'reducers/interfaces'; ...@@ -13,6 +13,19 @@ import { CombinedState } from 'reducers/interfaces';
import { hideShowContextImage, getContextImage } from 'actions/annotation-actions'; import { hideShowContextImage, getContextImage } from 'actions/annotation-actions';
import CVATTooltip from 'components/common/cvat-tooltip'; import CVATTooltip from 'components/common/cvat-tooltip';
export function adjustContextImagePosition(sidebarCollapsed: boolean): void {
const element = window.document.getElementsByClassName('cvat-context-image-wrapper')[0] as
| HTMLDivElement
| undefined;
if (element) {
if (sidebarCollapsed) {
element.style.right = '40px';
} else {
element.style.right = '';
}
}
}
export default function ContextImage(): JSX.Element | null { export default function ContextImage(): JSX.Element | null {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { number: frame, hasRelatedContext } = useSelector((state: CombinedState) => state.annotation.player.frame); const { number: frame, hasRelatedContext } = useSelector((state: CombinedState) => state.annotation.player.frame);
......
...@@ -17,7 +17,6 @@ import { CombinedState } from 'reducers/interfaces'; ...@@ -17,7 +17,6 @@ import { CombinedState } from 'reducers/interfaces';
export default function LabelsListComponent(): JSX.Element { export default function LabelsListComponent(): JSX.Element {
const dispatch = useDispatch(); const dispatch = useDispatch();
const tabContentHeight = useSelector((state: CombinedState) => state.annotation.tabContentHeight);
const frame = useSelector((state: CombinedState): number => state.annotation.player.frame.number); const frame = useSelector((state: CombinedState): number => state.annotation.player.frame.number);
const frameIssues = useSelector((state: CombinedState): any[] => state.review.frameIssues); const frameIssues = useSelector((state: CombinedState): any[] => state.review.frameIssues);
const issues = useSelector((state: CombinedState): any[] => state.review.issues); const issues = useSelector((state: CombinedState): any[] => state.review.issues);
...@@ -50,7 +49,7 @@ export default function LabelsListComponent(): JSX.Element { ...@@ -50,7 +49,7 @@ export default function LabelsListComponent(): JSX.Element {
}; };
return ( return (
<div style={{ height: tabContentHeight }}> <>
<div className='cvat-objects-sidebar-issues-list-header'> <div className='cvat-objects-sidebar-issues-list-header'>
<Row justify='start' align='middle'> <Row justify='start' align='middle'>
<Col> <Col>
...@@ -122,6 +121,6 @@ export default function LabelsListComponent(): JSX.Element { ...@@ -122,6 +121,6 @@ export default function LabelsListComponent(): JSX.Element {
), ),
)} )}
</div> </div>
</div> </>
); );
} }
...@@ -14,7 +14,6 @@ import GlobalHotKeys from 'utils/mousetrap-react'; ...@@ -14,7 +14,6 @@ import GlobalHotKeys from 'utils/mousetrap-react';
function LabelsListComponent(): JSX.Element { function LabelsListComponent(): JSX.Element {
const dispatch = useDispatch(); const dispatch = useDispatch();
const labels = useSelector((state: CombinedState) => state.annotation.job.labels); const labels = useSelector((state: CombinedState) => state.annotation.job.labels);
const listHeight = useSelector((state: CombinedState) => state.annotation.tabContentHeight);
const activatedStateID = useSelector((state: CombinedState) => state.annotation.annotations.activatedStateID); const activatedStateID = useSelector((state: CombinedState) => state.annotation.annotations.activatedStateID);
const states = useSelector((state: CombinedState) => state.annotation.annotations.states); const states = useSelector((state: CombinedState) => state.annotation.annotations.states);
const keyMap = useSelector((state: CombinedState) => state.shortcuts.keyMap); const keyMap = useSelector((state: CombinedState) => state.shortcuts.keyMap);
...@@ -87,7 +86,7 @@ function LabelsListComponent(): JSX.Element { ...@@ -87,7 +86,7 @@ function LabelsListComponent(): JSX.Element {
}; };
return ( return (
<div style={{ height: listHeight }} className='cvat-objects-sidebar-labels-list'> <div className='cvat-objects-sidebar-labels-list'>
<GlobalHotKeys keyMap={subKeyMap} handlers={handlers} /> <GlobalHotKeys keyMap={subKeyMap} handlers={handlers} />
{labelIDs.map( {labelIDs.map(
(labelID: number): JSX.Element => ( (labelID: number): JSX.Element => (
......
// Copyright (C) 2020 Intel Corporation // Copyright (C) 2020-2021 Intel Corporation
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
...@@ -10,7 +10,6 @@ import ObjectListHeader from './objects-list-header'; ...@@ -10,7 +10,6 @@ import ObjectListHeader from './objects-list-header';
interface Props { interface Props {
readonly: boolean; readonly: boolean;
listHeight: number;
statesHidden: boolean; statesHidden: boolean;
statesLocked: boolean; statesLocked: boolean;
statesCollapsedAll: boolean; statesCollapsedAll: boolean;
...@@ -31,7 +30,6 @@ interface Props { ...@@ -31,7 +30,6 @@ interface Props {
function ObjectListComponent(props: Props): JSX.Element { function ObjectListComponent(props: Props): JSX.Element {
const { const {
readonly, readonly,
listHeight,
statesHidden, statesHidden,
statesLocked, statesLocked,
statesCollapsedAll, statesCollapsedAll,
...@@ -50,7 +48,7 @@ function ObjectListComponent(props: Props): JSX.Element { ...@@ -50,7 +48,7 @@ function ObjectListComponent(props: Props): JSX.Element {
} = props; } = props;
return ( return (
<div style={{ height: listHeight }}> <>
<ObjectListHeader <ObjectListHeader
readonly={readonly} readonly={readonly}
statesHidden={statesHidden} statesHidden={statesHidden}
...@@ -80,7 +78,7 @@ function ObjectListComponent(props: Props): JSX.Element { ...@@ -80,7 +78,7 @@ function ObjectListComponent(props: Props): JSX.Element {
), ),
)} )}
</div> </div>
</div> </>
); );
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
import './styles.scss'; import './styles.scss';
import React, { Dispatch, useEffect, TransitionEvent } from 'react'; import React, { Dispatch, TransitionEvent } from 'react';
import { AnyAction } from 'redux'; import { AnyAction } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons'; import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
...@@ -12,13 +12,12 @@ import Tabs from 'antd/lib/tabs'; ...@@ -12,13 +12,12 @@ import Tabs from 'antd/lib/tabs';
import Layout from 'antd/lib/layout'; import Layout from 'antd/lib/layout';
import { Canvas } from 'cvat-canvas-wrapper'; import { Canvas } from 'cvat-canvas-wrapper';
import { Canvas3d } from 'cvat-canvas3d-wrapper';
import { CombinedState } from 'reducers/interfaces'; import { CombinedState } from 'reducers/interfaces';
import LabelsList from 'components/annotation-page/standard-workspace/objects-side-bar/labels-list'; import LabelsList from 'components/annotation-page/standard-workspace/objects-side-bar/labels-list';
import { import { adjustContextImagePosition } from 'components/annotation-page/standard-workspace/context-image/context-image';
collapseSidebar as collapseSidebarAction, import { collapseSidebar as collapseSidebarAction } from 'actions/annotation-actions';
updateTabContentHeight as updateTabContentHeightAction, import AppearanceBlock from 'components/annotation-page/appearance-block';
} from 'actions/annotation-actions';
import AppearanceBlock, { computeHeight } from 'components/annotation-page/appearance-block';
import IssuesListComponent from 'components/annotation-page/standard-workspace/objects-side-bar/issues-list'; import IssuesListComponent from 'components/annotation-page/standard-workspace/objects-side-bar/issues-list';
interface OwnProps { interface OwnProps {
...@@ -27,12 +26,11 @@ interface OwnProps { ...@@ -27,12 +26,11 @@ interface OwnProps {
interface StateToProps { interface StateToProps {
sidebarCollapsed: boolean; sidebarCollapsed: boolean;
canvasInstance: Canvas; canvasInstance: Canvas | Canvas3d;
} }
interface DispatchToProps { interface DispatchToProps {
collapseSidebar(): void; collapseSidebar(): void;
updateTabContentHeight(): void;
} }
function mapStateToProps(state: CombinedState): StateToProps { function mapStateToProps(state: CombinedState): StateToProps {
...@@ -54,33 +52,14 @@ function mapDispatchToProps(dispatch: Dispatch<AnyAction>): DispatchToProps { ...@@ -54,33 +52,14 @@ function mapDispatchToProps(dispatch: Dispatch<AnyAction>): DispatchToProps {
collapseSidebar(): void { collapseSidebar(): void {
dispatch(collapseSidebarAction()); dispatch(collapseSidebarAction());
}, },
updateTabContentHeight(): void {
const height = computeHeight();
dispatch(updateTabContentHeightAction(height));
},
}; };
} }
function ObjectsSideBar(props: StateToProps & DispatchToProps & OwnProps): JSX.Element { function ObjectsSideBar(props: StateToProps & DispatchToProps & OwnProps): JSX.Element {
const { const {
sidebarCollapsed, canvasInstance, collapseSidebar, updateTabContentHeight, objectsList, sidebarCollapsed, canvasInstance, collapseSidebar, objectsList,
} = props; } = props;
useEffect(() => {
const alignTabHeight = (): void => {
if (!sidebarCollapsed) {
updateTabContentHeight();
}
};
window.addEventListener('resize', alignTabHeight);
alignTabHeight();
return () => {
window.removeEventListener('resize', alignTabHeight);
};
}, []);
const collapse = (): void => { const collapse = (): void => {
const [collapser] = window.document.getElementsByClassName('cvat-objects-sidebar'); const [collapser] = window.document.getElementsByClassName('cvat-objects-sidebar');
const listener = (event: TransitionEvent): void => { const listener = (event: TransitionEvent): void => {
...@@ -95,6 +74,7 @@ function ObjectsSideBar(props: StateToProps & DispatchToProps & OwnProps): JSX.E ...@@ -95,6 +74,7 @@ function ObjectsSideBar(props: StateToProps & DispatchToProps & OwnProps): JSX.E
(collapser as HTMLElement).addEventListener('transitionend', listener as any); (collapser as HTMLElement).addEventListener('transitionend', listener as any);
} }
adjustContextImagePosition(!sidebarCollapsed);
collapseSidebar(); collapseSidebar();
}; };
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
.cvat-objects-appearance-collapse.ant-collapse { .cvat-objects-appearance-collapse.ant-collapse {
width: 100%; width: 100%;
bottom: 0;
position: absolute;
border-radius: 0; border-radius: 0;
> .ant-collapse-item { > .ant-collapse-item {
......
...@@ -73,6 +73,23 @@ ...@@ -73,6 +73,23 @@
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
> .ant-layout-sider-children {
display: flex;
flex-direction: column;
> .cvat-objects-sidebar-tabs {
flex-grow: 10;
> div {
display: flex;
div[role='tabpanel'] {
height: 100%;
}
}
}
}
&.ant-layout-sider-collapsed { &.ant-layout-sider-collapsed {
overflow: initial; overflow: initial;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
height: 100%; height: 100%;
} }
.cvat-tag-annotation-sidebar { .cvat-tag-annotation-sidebar:not(.ant-layout-sider-collapsed) {
background: $background-color-2; background: $background-color-2;
padding: 5px; padding: 5px;
......
...@@ -21,7 +21,9 @@ import { ...@@ -21,7 +21,9 @@ import {
rememberObject, rememberObject,
} from 'actions/annotation-actions'; } from 'actions/annotation-actions';
import { Canvas } from 'cvat-canvas-wrapper'; import { Canvas } from 'cvat-canvas-wrapper';
import { Canvas3d } from 'cvat-canvas3d-wrapper';
import { CombinedState, ObjectType } from 'reducers/interfaces'; import { CombinedState, ObjectType } from 'reducers/interfaces';
import { adjustContextImagePosition } from 'components/annotation-page/standard-workspace/context-image/context-image';
import LabelSelector from 'components/label-selector/label-selector'; import LabelSelector from 'components/label-selector/label-selector';
import getCore from 'cvat-core-wrapper'; import getCore from 'cvat-core-wrapper';
import GlobalHotKeys, { KeyMap } from 'utils/mousetrap-react'; import GlobalHotKeys, { KeyMap } from 'utils/mousetrap-react';
...@@ -33,7 +35,7 @@ interface StateToProps { ...@@ -33,7 +35,7 @@ interface StateToProps {
states: any[]; states: any[];
labels: any[]; labels: any[];
jobInstance: any; jobInstance: any;
canvasInstance: Canvas; canvasInstance: Canvas | Canvas3d;
frameNumber: number; frameNumber: number;
keyMap: KeyMap; keyMap: KeyMap;
normalizedKeyMap: Record<string, string>; normalizedKeyMap: Record<string, string>;
...@@ -203,7 +205,10 @@ function TagAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.Elemen ...@@ -203,7 +205,10 @@ function TagAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.Elemen
className={`cvat-objects-sidebar-sider className={`cvat-objects-sidebar-sider
ant-layout-sider-zero-width-trigger ant-layout-sider-zero-width-trigger
ant-layout-sider-zero-width-trigger-left`} ant-layout-sider-zero-width-trigger-left`}
onClick={() => setSidebarCollapsed(!sidebarCollapsed)} onClick={() => {
adjustContextImagePosition(!sidebarCollapsed);
setSidebarCollapsed(!sidebarCollapsed);
}}
> >
{sidebarCollapsed ? <MenuFoldOutlined title='Show' /> : <MenuUnfoldOutlined title='Hide' />} {sidebarCollapsed ? <MenuFoldOutlined title='Show' /> : <MenuUnfoldOutlined title='Hide' />}
</span> </span>
...@@ -222,7 +227,10 @@ function TagAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.Elemen ...@@ -222,7 +227,10 @@ function TagAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.Elemen
className={`cvat-objects-sidebar-sider className={`cvat-objects-sidebar-sider
ant-layout-sider-zero-width-trigger ant-layout-sider-zero-width-trigger
ant-layout-sider-zero-width-trigger-left`} ant-layout-sider-zero-width-trigger-left`}
onClick={() => setSidebarCollapsed(!sidebarCollapsed)} onClick={() => {
adjustContextImagePosition(!sidebarCollapsed);
setSidebarCollapsed(!sidebarCollapsed);
}}
> >
{sidebarCollapsed ? <MenuFoldOutlined title='Show' /> : <MenuUnfoldOutlined title='Hide' />} {sidebarCollapsed ? <MenuFoldOutlined title='Show' /> : <MenuUnfoldOutlined title='Hide' />}
</span> </span>
......
...@@ -17,6 +17,7 @@ import { ...@@ -17,6 +17,7 @@ import {
propagateObject as propagateObjectAction, propagateObject as propagateObjectAction,
} from 'actions/annotation-actions'; } from 'actions/annotation-actions';
import { Canvas } from 'cvat-canvas-wrapper'; import { Canvas } from 'cvat-canvas-wrapper';
import { Canvas3d } from 'cvat-canvas3d-wrapper';
import { import {
CombinedState, StatesOrdering, ObjectType, ColorBy, CombinedState, StatesOrdering, ObjectType, ColorBy,
} from 'reducers/interfaces'; } from 'reducers/interfaces';
...@@ -28,7 +29,6 @@ interface OwnProps { ...@@ -28,7 +29,6 @@ interface OwnProps {
interface StateToProps { interface StateToProps {
jobInstance: any; jobInstance: any;
frameNumber: any; frameNumber: any;
listHeight: number;
statesHidden: boolean; statesHidden: boolean;
statesLocked: boolean; statesLocked: boolean;
statesCollapsedAll: boolean; statesCollapsedAll: boolean;
...@@ -42,7 +42,7 @@ interface StateToProps { ...@@ -42,7 +42,7 @@ interface StateToProps {
maxZLayer: number; maxZLayer: number;
keyMap: KeyMap; keyMap: KeyMap;
normalizedKeyMap: Record<string, string>; normalizedKeyMap: Record<string, string>;
canvasInstance: Canvas; canvasInstance: Canvas | Canvas3d;
} }
interface DispatchToProps { interface DispatchToProps {
...@@ -71,7 +71,6 @@ function mapStateToProps(state: CombinedState): StateToProps { ...@@ -71,7 +71,6 @@ function mapStateToProps(state: CombinedState): StateToProps {
frame: { number: frameNumber }, frame: { number: frameNumber },
}, },
canvas: { instance: canvasInstance }, canvas: { instance: canvasInstance },
tabContentHeight: listHeight,
colors, colors,
}, },
settings: { settings: {
...@@ -94,7 +93,6 @@ function mapStateToProps(state: CombinedState): StateToProps { ...@@ -94,7 +93,6 @@ function mapStateToProps(state: CombinedState): StateToProps {
}); });
return { return {
listHeight,
statesHidden, statesHidden,
statesLocked, statesLocked,
statesCollapsedAll: collapsedAll, statesCollapsedAll: collapsedAll,
...@@ -263,7 +261,6 @@ class ObjectsListContainer extends React.PureComponent<Props, State> { ...@@ -263,7 +261,6 @@ class ObjectsListContainer extends React.PureComponent<Props, State> {
colors, colors,
colorBy, colorBy,
readonly, readonly,
listHeight,
statesCollapsedAll, statesCollapsedAll,
updateAnnotations, updateAnnotations,
changeGroupColor, changeGroupColor,
...@@ -441,7 +438,6 @@ class ObjectsListContainer extends React.PureComponent<Props, State> { ...@@ -441,7 +438,6 @@ class ObjectsListContainer extends React.PureComponent<Props, State> {
<> <>
<GlobalHotKeys keyMap={subKeyMap} handlers={handlers} /> <GlobalHotKeys keyMap={subKeyMap} handlers={handlers} />
<ObjectsListComponent <ObjectsListComponent
listHeight={listHeight}
statesHidden={statesHidden} statesHidden={statesHidden}
statesLocked={statesLocked} statesLocked={statesLocked}
statesCollapsedAll={statesCollapsedAll} statesCollapsedAll={statesCollapsedAll}
......
...@@ -109,7 +109,6 @@ const defaultState: AnnotationState = { ...@@ -109,7 +109,6 @@ const defaultState: AnnotationState = {
filtersPanelVisible: false, filtersPanelVisible: false,
requestReviewDialogVisible: false, requestReviewDialogVisible: false,
submitReviewDialogVisible: false, submitReviewDialogVisible: false,
tabContentHeight: 0,
predictor: { predictor: {
enabled: false, enabled: false,
error: null, error: null,
...@@ -405,13 +404,6 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { ...@@ -405,13 +404,6 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
appearanceCollapsed: !state.appearanceCollapsed, appearanceCollapsed: !state.appearanceCollapsed,
}; };
} }
case AnnotationActionTypes.UPDATE_TAB_CONTENT_HEIGHT: {
const { tabContentHeight } = action.payload;
return {
...state,
tabContentHeight,
};
}
case AnnotationActionTypes.COLLAPSE_OBJECT_ITEMS: { case AnnotationActionTypes.COLLAPSE_OBJECT_ITEMS: {
const { states, collapsed } = action.payload; const { states, collapsed } = action.payload;
......
...@@ -489,7 +489,6 @@ export interface AnnotationState { ...@@ -489,7 +489,6 @@ export interface AnnotationState {
submitReviewDialogVisible: boolean; submitReviewDialogVisible: boolean;
sidebarCollapsed: boolean; sidebarCollapsed: boolean;
appearanceCollapsed: boolean; appearanceCollapsed: boolean;
tabContentHeight: number;
workspace: Workspace; workspace: Workspace;
predictor: PredictorState; predictor: PredictorState;
aiToolsRef: MutableRefObject<any>; aiToolsRef: MutableRefObject<any>;
......
...@@ -9,7 +9,7 @@ import { KeyMap, KeyMapItem } from 'utils/mousetrap-react'; ...@@ -9,7 +9,7 @@ import { KeyMap, KeyMapItem } from 'utils/mousetrap-react';
import { ShortcutsState } from './interfaces'; import { ShortcutsState } from './interfaces';
function formatShortcuts(shortcuts: KeyMapItem): string { function formatShortcuts(shortcuts: KeyMapItem): string {
const list: string[] = shortcuts.sequences as string[]; const list: string[] = shortcuts.displayedSequences || (shortcuts.sequences as string[]);
return `[${list return `[${list
.map((shortcut: string): string => { .map((shortcut: string): string => {
let keys = shortcut.split('+'); let keys = shortcut.split('+');
...@@ -270,7 +270,8 @@ const defaultKeyMap = ({ ...@@ -270,7 +270,8 @@ const defaultKeyMap = ({
FOCUS_INPUT_FRAME: { FOCUS_INPUT_FRAME: {
name: 'Focus input frame', name: 'Focus input frame',
description: 'Focus on the element to change the current frame', description: 'Focus on the element to change the current frame',
sequences: ['~'], sequences: ['`'],
displayedSequences: ['~'],
action: 'keydown', action: 'keydown',
}, },
SWITCH_AUTOMATIC_BORDERING: { SWITCH_AUTOMATIC_BORDERING: {
......
...@@ -9,6 +9,7 @@ export interface KeyMapItem { ...@@ -9,6 +9,7 @@ export interface KeyMapItem {
name: string; name: string;
description: string; description: string;
sequences: string[]; sequences: string[];
displayedSequences?: string[];
action: 'keydown' | 'keyup' | 'keypress'; action: 'keydown' | 'keyup' | 'keypress';
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册