diff --git a/cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx b/cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx index 93d25911..666b504f 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx @@ -68,13 +68,15 @@ function PlayerNavigation(props: Props): JSX.Element { value={frameInputValue} // https://stackoverflow.com/questions/38256332/in-react-whats-the-difference-between-onchange-and-oninput onChange={(value: number | undefined) => { - setFrameInputValue( - Math.max( - Math.min( - Number(value), stopFrame, - ), startFrame, - ), - ); + if (typeof (value) === 'number') { + setFrameInputValue( + Math.max( + Math.min( + Number(value), stopFrame, + ), startFrame, + ), + ); + } }} onBlur={() => { onInputChange(frameInputValue); diff --git a/cvat-ui/src/components/settings-page/workspace-settings.tsx b/cvat-ui/src/components/settings-page/workspace-settings.tsx index a7a5fd2c..e287bb75 100644 --- a/cvat-ui/src/components/settings-page/workspace-settings.tsx +++ b/cvat-ui/src/components/settings-page/workspace-settings.tsx @@ -4,15 +4,10 @@ import React from 'react'; -import { - Row, - Col, - Checkbox, - InputNumber, -} from 'antd'; - +import { Row, Col } from 'antd/lib/grid'; +import Checkbox, { CheckboxChangeEvent } from 'antd/lib/checkbox'; +import InputNumber from 'antd/lib/input-number'; import Text from 'antd/lib/typography/Text'; -import { CheckboxChangeEvent } from 'antd/lib/checkbox'; interface Props { autoSave: boolean; @@ -37,6 +32,11 @@ export default function WorkspaceSettingsComponent(props: Props): JSX.Element { onSwitchShowingInterpolatedTracks, } = props; + const minAutoSaveInterval = 5; + const maxAutoSaveInterval = 60; + const minAAMMargin = 0; + const maxAAMMargin = 1000; + return (
@@ -56,13 +56,19 @@ export default function WorkspaceSettingsComponent(props: Props): JSX.Element { Auto save every { - if (value) { - onChangeAutoSaveInterval(value * 60 * 1000); + if (typeof (value) === 'number') { + onChangeAutoSaveInterval( + Math.max( + Math.min( + Number(value), maxAutoSaveInterval, + ), minAutoSaveInterval, + ) * 60 * 1000, + ); } }} /> @@ -89,12 +95,18 @@ export default function WorkspaceSettingsComponent(props: Props): JSX.Element { Attribute annotation mode (AAM) zoom margin { if (typeof (value) === 'number') { - onChangeAAMZoomMargin(value); + onChangeAAMZoomMargin( + Math.max( + Math.min( + Number(value), maxAAMMargin, + ), minAAMMargin, + ), + ); } }} />