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

Using "alt" instead of "ctrl" to delete a point, fixed reducer #2204

Merged
merged 3 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- UI models (like DEXTR) were redesigned to be more interactive (<https://github.com/opencv/cvat/pull/2054>)
- Used Ubuntu:20.04 as a base image for CVAT Dockerfile (<https://github.com/opencv/cvat/pull/2101>)
- Right colors of label tags in label mapping when a user runs automatic detection (<https://github.com/openvinotoolkit/cvat/pull/2162>)
- A key to remove a point from a polyshape [Ctrl => Alt] (<https://github.com/openvinotoolkit/cvat/pull/2204>)

### Deprecated
-
Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-canvas",
"version": "2.1.0",
"version": "2.1.1",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
));

if (['polygon', 'polyline', 'points'].includes(state.shapeType)) {
if (e.ctrlKey) {
if (e.altKey) {
const { points } = state;
self.onEditDone(
state,
Expand Down Expand Up @@ -897,7 +897,6 @@ export class CanvasViewImpl implements CanvasView, Listener {

// Setup event handlers
this.content.addEventListener('dblclick', (e: MouseEvent): void => {
if (e.ctrlKey || e.shiftKey) return;
self.controller.fit();
e.preventDefault();
});
Expand Down Expand Up @@ -933,7 +932,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
self.controller.drag(e.clientX, e.clientY);

if (this.mode !== Mode.IDLE) return;
if (e.ctrlKey || e.shiftKey) return;
if (e.ctrlKey || e.altKey) return;

const { offset } = this.controller.geometry;
const [x, y] = translateToSVG(this.content, [e.clientX, e.clientY]);
Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas/src/typescript/svg.patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ SVG.Element.prototype.resize = function constructor(...args: any): any {
handler = this.remember('_resizeHandler');
handler.resize = function(e: any) {
const { event } = e.detail;
if (event.button === 0 && !event.shiftKey && !event.ctrlKey) {
if (event.button === 0 && !event.shiftKey && !event.altKey) {
return handler.constructor.prototype.resize.call(this, e);
}
}
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.9.5",
"version": "1.9.6",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function CanvasPointContextMenu(props: Props): React.ReactPortal | null {
return visible && contextMenuFor && type === ContextMenuType.CANVAS_SHAPE_POINT
? (ReactDOM.createPortal(
<div className='cvat-canvas-point-context-menu' style={{ top, left }}>
<Tooltip title='Delete point [Ctrl + dblclick]' mouseLeaveDelay={0}>
<Tooltip title='Delete point [Alt + dblclick]' mouseLeaveDelay={0}>
<Button type='link' icon='delete' onClick={onPointDelete}>
Delete point
</Button>
Expand Down
19 changes: 15 additions & 4 deletions cvat-ui/src/reducers/models-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,26 @@ export default function (
}
case ModelsActionTypes.GET_INFERENCE_STATUS_SUCCESS: {
const { inferences } = state;

if (action.payload.activeInference.status === 'finished') {
delete inferences[action.payload.taskID];
} else {
inferences[action.payload.taskID] = action.payload.activeInference;
return {
...state,
inferences: Object.fromEntries(
Object.entries(inferences)
.filter(([key]): boolean => +key !== action.payload.taskID),
),
};
}

const update: any = {};
update[action.payload.taskID] = action.payload.activeInference;

return {
...state,
inferences: { ...inferences },
inferences: {
...state.inferences,
...update,
},
};
}
case ModelsActionTypes.GET_INFERENCE_STATUS_FAILED: {
Expand Down