You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB
TypeScript

// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
import React from 'react';
import Icon from 'antd/lib/icon';
import Tooltip from 'antd/lib/tooltip';
import { CursorIcon } from 'icons';
import { ActiveControl } from 'reducers/interfaces';
import { Canvas } from 'cvat-canvas-wrapper';
interface Props {
canvasInstance: Canvas;
cursorShortkey: string;
activeControl: ActiveControl;
}
function CursorControl(props: Props): JSX.Element {
const {
canvasInstance,
activeControl,
cursorShortkey,
} = props;
return (
<Tooltip title={`Cursor ${cursorShortkey}`} placement='right' mouseLeaveDelay={0}>
<Icon
component={CursorIcon}
className={activeControl === ActiveControl.CURSOR
? 'cvat-active-canvas-control' : ''}
onClick={
activeControl !== ActiveControl.CURSOR
? (): void => canvasInstance.cancel()
: undefined
}
/>
</Tooltip>
);
}
export default React.memo(CursorControl);