-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
965ff77
wip
ActiveChooN 4d0c225
temp
ActiveChooN b0dbbb3
Merge branch 'develop' into dk/point-deletion
ActiveChooN 845be3b
Added point deletion context menu
ActiveChooN 1c1ab6a
fixed point context menu for rectangles
ActiveChooN 7e7a5a6
Merge branch 'develop' into dk/point-deletion
ActiveChooN 56f58b6
Fixed context menu on ubuntu
ActiveChooN 8aaa4d2
Fixed deleting of the latest point
bsekachev 56c6f11
Merge pull request #1304 from opencv/bs/delete_points_fix
ActiveChooN c11cc64
fixes
ActiveChooN 3c128b2
fixed PR
ActiveChooN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
cvat-ui/src/components/annotation-page/standard-workspace/canvas-point-context-menu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,3 +119,77 @@ | |
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; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have you duplicated style from |
||
|
||
.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; | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more duplicate |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's import exact components in future code
Not from
antd
wrapperIt common recommendation to reduce bundle size