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.
42 lines
888 B
TypeScript
42 lines
888 B
TypeScript
// Copyright (C) 2020 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import React from 'react';
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import {
|
|
Button,
|
|
} from 'antd';
|
|
|
|
interface Props {
|
|
activatedStateID: number | null;
|
|
visible: boolean;
|
|
left: number;
|
|
top: number;
|
|
onPointDelete(): void;
|
|
}
|
|
|
|
export default function CanvasPointContextMenu(props: Props): JSX.Element | null {
|
|
const {
|
|
onPointDelete,
|
|
activatedStateID,
|
|
visible,
|
|
left,
|
|
top,
|
|
} = props;
|
|
|
|
if (!visible || activatedStateID === null) {
|
|
return null;
|
|
}
|
|
|
|
return ReactDOM.createPortal(
|
|
<div className='cvat-canvas-point-context-menu' style={{ top, left }}>
|
|
<Button type='link' icon='delete' onClick={onPointDelete}>
|
|
Delete point
|
|
</Button>
|
|
</div>,
|
|
window.document.body,
|
|
);
|
|
}
|