-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Added the feature to Remove annotation objects in a specified range of frames #3617
Changes from 23 commits
25527db
aab67f4
a085554
7839fe8
c092a56
4d39b94
cde900f
5ed81c3
6f5b922
d47db3c
25bbb49
6dba4e8
d72833d
abca64f
fb30089
2e714f1
88d1ec1
6cc2403
5317c04
c7a4a03
e5c23b0
455466f
a313f46
8b0dc67
96e73a7
b92b93c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,13 @@ | |
// SPDX-License-Identifier: MIT | ||
|
||
import React from 'react'; | ||
|
||
import Menu from 'antd/lib/menu'; | ||
import Modal from 'antd/lib/modal'; | ||
import Text from 'antd/lib/typography/Text'; | ||
import { | ||
InputNumber, Tooltip, Checkbox, Collapse, | ||
} from 'antd'; | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { MenuInfo } from 'rc-menu/lib/interface'; | ||
|
||
|
@@ -20,6 +25,8 @@ interface Props { | |
jobInstance: any; | ||
onClickMenu(params: MenuInfo): void; | ||
onUploadAnnotations(format: string, file: File): void; | ||
stopFrame: number; | ||
removeAnnotations(startnumber: number, endnumber: number, delTrackKeyframesOnly:boolean): void; | ||
setForceExitAnnotationFlag(forceExit: boolean): void; | ||
saveAnnotations(jobInstance: any, afterSave?: () => void): void; | ||
} | ||
|
@@ -41,8 +48,10 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { | |
loadActivity, | ||
isReviewer, | ||
jobInstance, | ||
stopFrame, | ||
onClickMenu, | ||
onUploadAnnotations, | ||
removeAnnotations, | ||
setForceExitAnnotationFlag, | ||
saveAnnotations, | ||
} = props; | ||
|
@@ -80,14 +89,52 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { | |
} | ||
|
||
if (params.key === Actions.REMOVE_ANNO) { | ||
let removeFrom: any; | ||
let removeUpTo: any; | ||
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. Please, use |
||
let removeOnlyKeyframes: any = false; | ||
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. Please, use: 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. I did change the numbers but ESLint is throwing this error for boolean, it is suggesting to keep
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. Okay, than just: let removeOnlyKeyframes = false; |
||
const { Panel } = Collapse; | ||
Modal.confirm({ | ||
title: 'All the annotations will be removed', | ||
content: | ||
'You are going to remove all the annotations from the client. ' + | ||
'It will stay on the server till you save the job. Continue?', | ||
title: 'Remove Annotations', | ||
content: ( | ||
<div> | ||
<Text>You are going to remove the annotations from the client. </Text> | ||
<Text>It will stay on the server till you save the job. Continue?</Text> | ||
<br /> | ||
<br /> | ||
<Collapse bordered={false}> | ||
<Panel header={<Text>Select Range</Text>} key={1}> | ||
<Text>From: </Text> | ||
<InputNumber | ||
min={0} | ||
max={stopFrame} | ||
onChange={(value) => { | ||
removeFrom = value; | ||
}} | ||
/> | ||
<Text> To: </Text> | ||
<InputNumber | ||
min={0} | ||
max={stopFrame} | ||
onChange={(value) => { removeUpTo = value; }} | ||
/> | ||
<Tooltip title='Applicable only for annotations in range'> | ||
<br /> | ||
<br /> | ||
<Checkbox | ||
onChange={(check) => { | ||
removeOnlyKeyframes = check.target.checked; | ||
}} | ||
> | ||
Delete only keyframes for tracks | ||
</Checkbox> | ||
</Tooltip> | ||
</Panel> | ||
</Collapse> | ||
</div> | ||
), | ||
className: 'cvat-modal-confirm-remove-annotation', | ||
onOk: () => { | ||
onClickMenu(params); | ||
removeAnnotations(removeFrom, removeUpTo, removeOnlyKeyframes); | ||
}, | ||
okButtonProps: { | ||
type: 'primary', | ||
|
@@ -127,7 +174,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { | |
const is2d = jobInstance.task.dimension === DimensionType.DIM_2D; | ||
|
||
return ( | ||
<Menu onClick={onClickMenuWrapper} className='cvat-annotation-menu' selectable={false}> | ||
<Menu onClick={(params: MenuInfo) => onClickMenuWrapper(params)} className='cvat-annotation-menu' selectable={false}> | ||
{LoadSubmenu({ | ||
loaders, | ||
loadActivity, | ||
|
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.
I believe if remove from range, this flag should not be set to true.
If this flag is true, client sends
put
annotation request and all annotations are removed from the database.If this flag is false, client sends only changes.