// Copyright (C) 2020 Intel Corporation // // SPDX-License-Identifier: MIT import React from 'react'; import Icon from 'antd/lib/icon'; import Menu from 'antd/lib/menu'; import Button from 'antd/lib/button'; import Modal from 'antd/lib/modal'; import Tooltip from 'antd/lib/tooltip'; import { BackgroundIcon, ForegroundIcon, ResetPerspectiveIcon, ColorizeIcon, } from 'icons'; import { ObjectType, ShapeType, ColorBy } from 'reducers/interfaces'; import ColorPicker from './color-picker'; interface Props { readonly: boolean; serverID: number | undefined; locked: boolean; shapeType: ShapeType; objectType: ObjectType; color: string; colorBy: ColorBy; colorPickerVisible: boolean; changeColorShortcut: string; copyShortcut: string; pasteShortcut: string; propagateShortcut: string; toBackgroundShortcut: string; toForegroundShortcut: string; removeShortcut: string; changeColor(value: string): void; copy(): void; remove(): void; propagate(): void; createURL(): void; switchOrientation(): void; toBackground(): void; toForeground(): void; resetCuboidPerspective(): void; changeColorPickerVisible(visible: boolean): void; activateTracking(): void; } interface ItemProps { toolProps: Props; } function CreateURLItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { serverID, createURL } = toolProps; return ( ); } function MakeCopyItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { copyShortcut, pasteShortcut, copy } = toolProps; return ( ); } function PropagateItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { propagateShortcut, propagate } = toolProps; return ( ); } function TrackingItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { activateTracking } = toolProps; return ( ); } function SwitchOrientationItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { switchOrientation } = toolProps; return ( ); } function ResetPerspectiveItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { resetCuboidPerspective } = toolProps; return ( ); } function ToBackgroundItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { toBackgroundShortcut, toBackground } = toolProps; return ( ); } function ToForegroundItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { toForegroundShortcut, toForeground } = toolProps; return ( ); } function SwitchColorItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { color, colorPickerVisible, changeColorShortcut, colorBy, changeColor, changeColorPickerVisible, } = toolProps; return ( ); } function RemoveItem(props: ItemProps): JSX.Element { const { toolProps, ...rest } = props; const { removeShortcut, locked, remove } = toolProps; return ( ); } export default function ItemMenu(props: Props): JSX.Element { const { readonly, shapeType, objectType, colorBy, } = props; return ( {!readonly && } {!readonly && } {!readonly && objectType === ObjectType.TRACK && shapeType === ShapeType.RECTANGLE && ( )} {!readonly && [ShapeType.POLYGON, ShapeType.POLYLINE, ShapeType.CUBOID].includes(shapeType) && ( )} {!readonly && shapeType === ShapeType.CUBOID && } {!readonly && objectType !== ObjectType.TAG && } {!readonly && objectType !== ObjectType.TAG && } {[ColorBy.INSTANCE, ColorBy.GROUP].includes(colorBy) && } {!readonly && } ); }