diff --git a/CHANGELOG.md b/CHANGELOG.md index 431512d1eac..ee536a6f5bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Image compression` definition mismatch () - Points are dublicated during polygon interpolation sometimes () - When redraw a shape with activated autobordering, previous points are visible () +- No mapping between side object element and context menu in some attributes () ### Security - diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 4e0103d7b5e..f90e4e9fe5a 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.6.2", + "version": "1.6.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 9ddda93f9b7..6c4281dd973 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.6.2", + "version": "1.6.3", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/canvas-context-menu.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/canvas-context-menu.tsx index 3cbd316d99d..9293318f472 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/canvas-context-menu.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/canvas-context-menu.tsx @@ -28,7 +28,7 @@ export default function CanvasContextMenu(props: Props): JSX.Element | null { return ReactDOM.createPortal(
- +
, window.document.body, ); diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/object-item-attribute.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/object-item-attribute.tsx index 89f6ea46c5e..2996591944c 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/object-item-attribute.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/object-item-attribute.tsx @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MIT -import React from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import { Col } from 'antd/lib/grid'; import Select from 'antd/lib/select'; import Radio, { RadioChangeEvent } from 'antd/lib/radio'; @@ -124,7 +124,6 @@ function ItemAttributeComponent(props: Props): JSX.Element { if (attrInputType === 'number') { const [min, max, step] = attrValues.map((value: string): number => +value); - return ( <> @@ -153,6 +152,25 @@ function ItemAttributeComponent(props: Props): JSX.Element { ); } + const ref = useRef(null); + const [selection, setSelection] = useState<{ + start: number | null; + end: number | null; + direction: 'forward' | 'backward' | 'none' | null; + }>({ + start: null, + end: null, + direction: null, + }); + + useEffect(() => { + if (ref.current && ref.current.input) { + ref.current.input.selectionStart = selection.start; + ref.current.input.selectionEnd = selection.end; + ref.current.input.selectionDirection = selection.direction; + } + }, [attrValue]); + return ( <> @@ -162,11 +180,20 @@ function ItemAttributeComponent(props: Props): JSX.Element { ): void => { + if (ref.current && ref.current.input) { + setSelection({ + start: ref.current.input.selectionStart, + end: ref.current.input.selectionEnd, + direction: ref.current.input.selectionDirection, + }); + } + changeAttribute(attrID, event.target.value); }} - defaultValue={attrValue} + value={attrValue} className='cvat-object-item-text-attribute' />