// 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; showObjectsTextAlways: boolean; automaticBordering: boolean; onSwitchAutoSave(enabled: boolean): void; onChangeAutoSaveInterval(interval: number): void; onChangeAAMZoomMargin(margin: number): void; onSwitchShowingInterpolatedTracks(enabled: boolean): void; onSwitchShowingObjectsTextAlways(enabled: boolean): void; onSwitchAutomaticBordering(enabled: boolean): void; } export default function WorkspaceSettingsComponent(props: Props): JSX.Element { const { autoSave, autoSaveInterval, aamZoomMargin, showAllInterpolationTracks, showObjectsTextAlways, automaticBordering, onSwitchAutoSave, onChangeAutoSaveInterval, onChangeAAMZoomMargin, onSwitchShowingInterpolatedTracks, onSwitchShowingObjectsTextAlways, onSwitchAutomaticBordering, } = props; const minAutoSaveInterval = 1; const maxAutoSaveInterval = 60; const minAAMMargin = 0; const maxAAMMargin = 1000; return (
{ onSwitchAutoSave(event.target.checked); }} > Enable auto save Auto save every { if (typeof value !== 'undefined') { 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 { onSwitchShowingObjectsTextAlways(event.target.checked); }} > Always show object details {' '} Show text for an object on the canvas not only when the object is activated {' '} { onSwitchAutomaticBordering(event.target.checked); }} > Automatic bordering {' '} Enable automatic bordering for polygons and polylines during drawing/editing {' '} Attribute annotation mode (AAM) zoom margin { if (typeof value !== 'undefined') { onChangeAAMZoomMargin(Math.floor(clamp(+value, minAAMMargin, maxAAMMargin))); } }} />
); }