Skip to content

Commit

Permalink
Using "alt" instead of "ctrl" to delete a point, fixed reducer (#2204)
Browse files Browse the repository at this point in the history
* Using alt instead of ctrl to delete a point, fixed reducer

* Updated versions

* Updated changelog
  • Loading branch information
bsekachev authored Sep 21, 2020
1 parent 4a80959 commit 4d869c3
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 13 deletions.
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

0 comments on commit 4d869c3

Please sign in to comment.