Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React UI: Point deletion context menu #1292

Merged
merged 11 commits into from
Mar 24, 2020
Prev Previous commit
fixed PR
  • Loading branch information
ActiveChooN committed Mar 24, 2020
commit 3c128b2a73ce265ff3c30e0f93251cc17294ba2b
2 changes: 1 addition & 1 deletion cvat-ui/src/actions/annotation-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ export function updateCanvasContextMenu(
visible: boolean,
left: number,
top: number,
pointID: number | null = null,
type?: ContextMenuType,
pointID?: number,
): AnyAction {
return {
type: AnnotationActionTypes.UPDATE_CANVAS_CONTEXT_MENU,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
import React from 'react';
import { GlobalHotKeys, KeyMap } from 'react-hotkeys';

import {
Layout,
Slider,
Icon,
Tooltip,
} from 'antd';
import Tooltip from 'antd/lib/tooltip';
import Icon from 'antd/lib/icon';
import Layout from 'antd/lib/layout/layout';
import Slider, { SliderValue } from 'antd/lib/slider';

import { SliderValue } from 'antd/lib/slider';
import {
ColorBy,
GridColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,77 +119,3 @@
margin: 0px 5px;
}
}

.cvat-canvas-context-menu {
opacity: 0.6;
position: fixed;
width: 300px;
z-index: 10;
max-height: 50%;
overflow-y: auto;

&:hover {
opacity: 1;
}
}

.cvat-canvas-point-context-menu {
opacity: 0.6;
position: fixed;
width: 135px;
z-index: 10;
max-height: 50%;
overflow-y: auto;
background-color: #ffffff;
border-radius: 4px;

&:hover {
opacity: 1;
}
}

.cvat-canvas-z-axis-wrapper {
position: absolute;
background: $background-color-2;
bottom: 10px;
right: 10px;
height: 150px;
z-index: 100;
border-radius: 6px;
opacity: 0.5;
border: 1px solid $border-color-3;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 3px;

&:hover {
opacity: 1;
}

> .ant-slider {
height: 75%;
margin: 5px 3px;

> .ant-slider-rail {
background-color: #979797;
}

> .ant-slider-handle {
transform: none !important;
}
}

> i {
opacity: 0.7;
color: $objects-bar-icons-color;

&:hover {
opacity: 1;
}

&:active {
opacity: 0.7;
}
}
}
15 changes: 15 additions & 0 deletions cvat-ui/src/components/annotation-page/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,21 @@
}
}

.cvat-canvas-point-context-menu {
opacity: 0.6;
position: fixed;
width: 135px;
z-index: 10;
max-height: 50%;
overflow-y: auto;
background-color: #ffffff;
border-radius: 4px;

&:hover {
opacity: 1;
}
}

.cvat-canvas-z-axis-wrapper {
position: absolute;
background: $background-color-2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import CanvasPointContextMenuComponent from 'components/annotation-page/standard

interface StateToProps {
activatedStateID: number | null;
activatedPointID: number | null | undefined;
activatedPointID: number | null;
states: any[];
visible: boolean;
top: number;
Expand Down Expand Up @@ -70,15 +70,15 @@ function mapDispatchToProps(dispatch: any): DispatchToProps {
type Props = StateToProps & DispatchToProps;

interface State {
activatedStateID: number | null | undefined;
activatedPointID: number | null | undefined;
activatedStateID: number | null;
activatedPointID: number | null;
latestLeft: number;
latestTop: number;
left: number;
top: number;
}

class CanvasContextMenuContainer extends React.PureComponent<Props, State> {
class CanvasPointContextMenuContainer extends React.PureComponent<Props, State> {
public constructor(props: Props) {
super(props);

Expand Down Expand Up @@ -190,4 +190,4 @@ class CanvasContextMenuContainer extends React.PureComponent<Props, State> {
export default connect(
mapStateToProps,
mapDispatchToProps,
)(CanvasContextMenuContainer);
)(CanvasPointContextMenuContainer);
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function mapDispatchToProps(dispatch: any): DispatchToProps {
},
onUpdateContextMenu(visible: boolean, left: number, top: number,
type: ContextMenuType, pointID?: number): void {
dispatch(updateCanvasContextMenu(visible, left, top, type, pointID));
dispatch(updateCanvasContextMenu(visible, left, top, pointID, type));
},
onAddZLayer(): void {
dispatch(addZLayer());
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/reducers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export interface AnnotationState {
top: number;
left: number;
type: ContextMenuType;
pointID: number | null | undefined;
pointID: number | null;
};
instance: Canvas;
ready: boolean;
Expand Down