|
|
|
|
@ -29,6 +29,7 @@ import {
|
|
|
|
|
NextIcon,
|
|
|
|
|
BackgroundIcon,
|
|
|
|
|
ForegroundIcon,
|
|
|
|
|
ResetPerspectiveIcon,
|
|
|
|
|
} from 'icons';
|
|
|
|
|
import { ObjectType, ShapeType } from 'reducers/interfaces';
|
|
|
|
|
import { clamp } from 'utils/math';
|
|
|
|
|
@ -38,6 +39,7 @@ function ItemMenu(
|
|
|
|
|
serverID: number | undefined,
|
|
|
|
|
locked: boolean,
|
|
|
|
|
objectType: ObjectType,
|
|
|
|
|
shapeType: ShapeType,
|
|
|
|
|
copyShortcut: string,
|
|
|
|
|
pasteShortcut: string,
|
|
|
|
|
propagateShortcut: string,
|
|
|
|
|
@ -50,6 +52,8 @@ function ItemMenu(
|
|
|
|
|
createURL: (() => void),
|
|
|
|
|
toBackground: (() => void),
|
|
|
|
|
toForeground: (() => void),
|
|
|
|
|
switchCuboidOrientation: (() => void),
|
|
|
|
|
resetCuboidPerspective: (() => void),
|
|
|
|
|
): JSX.Element {
|
|
|
|
|
return (
|
|
|
|
|
<Menu className='cvat-object-item-menu'>
|
|
|
|
|
@ -72,7 +76,22 @@ function ItemMenu(
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
{ objectType !== ObjectType.TAG && (
|
|
|
|
|
{shapeType === ShapeType.CUBOID && (
|
|
|
|
|
<Menu.Item>
|
|
|
|
|
<Button type='link' icon='retweet' onClick={switchCuboidOrientation}>
|
|
|
|
|
Switch orientation
|
|
|
|
|
</Button>
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
)}
|
|
|
|
|
{shapeType === ShapeType.CUBOID && (
|
|
|
|
|
<Menu.Item>
|
|
|
|
|
<Button type='link' onClick={resetCuboidPerspective}>
|
|
|
|
|
<Icon component={ResetPerspectiveIcon}/>
|
|
|
|
|
Reset perspective
|
|
|
|
|
</Button>
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
)}
|
|
|
|
|
{objectType !== ObjectType.TAG && (
|
|
|
|
|
<Menu.Item>
|
|
|
|
|
<Tooltip title={`${toBackgroundShortcut}`}>
|
|
|
|
|
<Button type='link' onClick={toBackground}>
|
|
|
|
|
@ -82,7 +101,7 @@ function ItemMenu(
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
)}
|
|
|
|
|
{ objectType !== ObjectType.TAG && (
|
|
|
|
|
{objectType !== ObjectType.TAG && (
|
|
|
|
|
<Menu.Item>
|
|
|
|
|
<Tooltip title={`${toForegroundShortcut}`}>
|
|
|
|
|
<Button type='link' onClick={toForeground}>
|
|
|
|
|
@ -125,6 +144,7 @@ interface ItemTopComponentProps {
|
|
|
|
|
labelID: number;
|
|
|
|
|
labels: any[];
|
|
|
|
|
objectType: ObjectType;
|
|
|
|
|
shapeType: ShapeType;
|
|
|
|
|
type: string;
|
|
|
|
|
locked: boolean;
|
|
|
|
|
copyShortcut: string;
|
|
|
|
|
@ -140,6 +160,8 @@ interface ItemTopComponentProps {
|
|
|
|
|
createURL(): void;
|
|
|
|
|
toBackground(): void;
|
|
|
|
|
toForeground(): void;
|
|
|
|
|
switchCuboidOrientation(): void;
|
|
|
|
|
resetCuboidPerspective(): void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ItemTopComponent(props: ItemTopComponentProps): JSX.Element {
|
|
|
|
|
@ -149,6 +171,7 @@ function ItemTopComponent(props: ItemTopComponentProps): JSX.Element {
|
|
|
|
|
labelID,
|
|
|
|
|
labels,
|
|
|
|
|
objectType,
|
|
|
|
|
shapeType,
|
|
|
|
|
type,
|
|
|
|
|
locked,
|
|
|
|
|
copyShortcut,
|
|
|
|
|
@ -164,6 +187,8 @@ function ItemTopComponent(props: ItemTopComponentProps): JSX.Element {
|
|
|
|
|
createURL,
|
|
|
|
|
toBackground,
|
|
|
|
|
toForeground,
|
|
|
|
|
switchCuboidOrientation,
|
|
|
|
|
resetCuboidPerspective,
|
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
@ -191,6 +216,7 @@ function ItemTopComponent(props: ItemTopComponentProps): JSX.Element {
|
|
|
|
|
serverID,
|
|
|
|
|
locked,
|
|
|
|
|
objectType,
|
|
|
|
|
shapeType,
|
|
|
|
|
copyShortcut,
|
|
|
|
|
pasteShortcut,
|
|
|
|
|
propagateShortcut,
|
|
|
|
|
@ -203,6 +229,8 @@ function ItemTopComponent(props: ItemTopComponentProps): JSX.Element {
|
|
|
|
|
createURL,
|
|
|
|
|
toBackground,
|
|
|
|
|
toForeground,
|
|
|
|
|
switchCuboidOrientation,
|
|
|
|
|
resetCuboidPerspective,
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<Icon type='more' />
|
|
|
|
|
@ -727,6 +755,8 @@ interface Props {
|
|
|
|
|
changeAttribute(attrID: number, value: string): void;
|
|
|
|
|
changeColor(color: string): void;
|
|
|
|
|
collapse(): void;
|
|
|
|
|
switchCuboidOrientation(): void;
|
|
|
|
|
resetCuboidPerspective(): void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function objectItemsAreEqual(prevProps: Props, nextProps: Props): boolean {
|
|
|
|
|
@ -804,6 +834,8 @@ function ObjectItemComponent(props: Props): JSX.Element {
|
|
|
|
|
changeAttribute,
|
|
|
|
|
changeColor,
|
|
|
|
|
collapse,
|
|
|
|
|
switchCuboidOrientation,
|
|
|
|
|
resetCuboidPerspective,
|
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
const type = objectType === ObjectType.TAG ? ObjectType.TAG.toUpperCase()
|
|
|
|
|
@ -842,6 +874,7 @@ function ObjectItemComponent(props: Props): JSX.Element {
|
|
|
|
|
labels={labels}
|
|
|
|
|
objectType={objectType}
|
|
|
|
|
type={type}
|
|
|
|
|
shapeType={shapeType}
|
|
|
|
|
locked={locked}
|
|
|
|
|
copyShortcut={normalizedKeyMap.COPY_SHAPE}
|
|
|
|
|
pasteShortcut={normalizedKeyMap.PASTE_SHAPE}
|
|
|
|
|
@ -856,6 +889,8 @@ function ObjectItemComponent(props: Props): JSX.Element {
|
|
|
|
|
createURL={createURL}
|
|
|
|
|
toBackground={toBackground}
|
|
|
|
|
toForeground={toForeground}
|
|
|
|
|
switchCuboidOrientation={switchCuboidOrientation}
|
|
|
|
|
resetCuboidPerspective={resetCuboidPerspective}
|
|
|
|
|
/>
|
|
|
|
|
<ItemButtons
|
|
|
|
|
shapeType={shapeType}
|
|
|
|
|
|