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.
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
// Copyright (C) 2020 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import React from 'react';
|
|
import Icon from '@ant-design/icons';
|
|
import Tooltip from 'antd/lib/tooltip';
|
|
|
|
import { ActiveControl } from 'reducers/interfaces';
|
|
import { Canvas } from 'cvat-canvas-wrapper';
|
|
import { RectangleIcon } from 'icons';
|
|
|
|
interface Props {
|
|
canvasInstance: Canvas;
|
|
activeControl: ActiveControl;
|
|
selectIssuePosition(enabled: boolean): void;
|
|
}
|
|
|
|
function ResizeControl(props: Props): JSX.Element {
|
|
const { activeControl, canvasInstance, selectIssuePosition } = props;
|
|
|
|
return (
|
|
<Tooltip title='Open an issue' placement='right' mouseLeaveDelay={0}>
|
|
<Icon
|
|
component={RectangleIcon}
|
|
className={
|
|
activeControl === ActiveControl.OPEN_ISSUE ?
|
|
'cvat-issue-control cvat-active-canvas-control' :
|
|
'cvat-issue-control'
|
|
}
|
|
onClick={(): void => {
|
|
if (activeControl === ActiveControl.OPEN_ISSUE) {
|
|
canvasInstance.selectRegion(false);
|
|
selectIssuePosition(false);
|
|
} else {
|
|
canvasInstance.cancel();
|
|
canvasInstance.selectRegion(true);
|
|
selectIssuePosition(true);
|
|
}
|
|
}}
|
|
/>
|
|
</Tooltip>
|
|
);
|
|
}
|
|
|
|
export default React.memo(ResizeControl);
|