// Copyright (C) 2020 Intel Corporation // // SPDX-License-Identifier: MIT import React from 'react'; 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 { clamp } from 'utils/math'; interface Props { autoSave: boolean; autoSaveInterval: number; aamZoomMargin: number; showAllInterpolationTracks: boolean; onSwitchAutoSave(enabled: boolean): void; onChangeAutoSaveInterval(interval: number): void; onChangeAAMZoomMargin(margin: number): void; onSwitchShowingInterpolatedTracks(enabled: boolean): void; } export default function WorkspaceSettingsComponent(props: Props): JSX.Element { const { autoSave, autoSaveInterval, aamZoomMargin, showAllInterpolationTracks, onSwitchAutoSave, onChangeAutoSaveInterval, onChangeAAMZoomMargin, onSwitchShowingInterpolatedTracks, } = props; const minAutoSaveInterval = 5; const maxAutoSaveInterval = 60; const minAAMMargin = 0; const maxAAMMargin = 1000; return (
{ onSwitchAutoSave(event.target.checked); }} > Enable auto save Auto save every { if (typeof (value) === 'number') { onChangeAutoSaveInterval(Math.floor( clamp( value, minAutoSaveInterval, maxAutoSaveInterval, ), ) * 60 * 1000); } }} /> minutes { onSwitchShowingInterpolatedTracks(event.target.checked); }} > Show all interpolation tracks Show hidden interpolated objects in the side panel Attribute annotation mode (AAM) zoom margin { if (typeof (value) === 'number') { onChangeAAMZoomMargin(Math.floor( clamp(value, minAAMMargin, maxAAMMargin), )); } }} />
); }