Skip to content

Commit

Permalink
Merge pull request #2507 from openvinotoolkit/bs/fixed_grouping
Browse files Browse the repository at this point in the history
Fixed grouping when press escape with drawn region or change a frame
  • Loading branch information
Boris Sekachev authored Dec 2, 2020
2 parents b217645 + 26d9eba commit a3026f4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Empty frames navigation (<https://github.com/openvinotoolkit/cvat/pull/2505>)
- Disabled position editing in AAM (<https://github.com/openvinotoolkit/cvat/pull/2506>)
- TypeError: Cannot read property 'toString' of undefined (<https://github.com/openvinotoolkit/cvat/pull/2517>)
- Extra shapes are drawn after Esc, or G pressed while drawing a region in grouping (<https://github.com/openvinotoolkit/cvat/pull/2507>)

### Security

Expand Down
25 changes: 14 additions & 11 deletions cvat-canvas/src/typescript/groupHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export class GroupHandlerImpl implements GroupHandler {
private getSelectionBox(
event: MouseEvent,
): {
xtl: number;
ytl: number;
xbr: number;
ybr: number;
} {
xtl: number;
ytl: number;
xbr: number;
ybr: number;
} {
const point = translateToSVG((this.canvas.node as any) as SVGSVGElement, [event.clientX, event.clientY]);
const stopSelectionPoint = {
x: point[0],
Expand Down Expand Up @@ -96,11 +96,11 @@ export class GroupHandlerImpl implements GroupHandler {
const bbox = shape.bbox();
const clientID = shape.attr('clientID');
if (
bbox.x > box.xtl &&
bbox.y > box.ytl &&
bbox.x + bbox.width < box.xbr &&
bbox.y + bbox.height < box.ybr &&
!(clientID in this.highlightedShapes)
bbox.x > box.xtl
&& bbox.y > box.ytl
&& bbox.x + bbox.width < box.xbr
&& bbox.y + bbox.height < box.ybr
&& !(clientID in this.highlightedShapes)
) {
const objectState = this.getStates().filter(
(state: any): boolean => state.clientID === clientID,
Expand All @@ -124,7 +124,6 @@ export class GroupHandlerImpl implements GroupHandler {

this.resetSelectedObjects();
this.initialized = false;
this.selectionRect = null;
this.startSelectionPoint = {
x: null,
y: null,
Expand Down Expand Up @@ -213,6 +212,10 @@ export class GroupHandlerImpl implements GroupHandler {
}
this.statesToBeGroupped = [];
this.highlightedShapes = {};
if (this.selectionRect) {
this.selectionRect.remove();
this.selectionRect = null;
}
}

public cancel(): void {
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.11.1",
"version": "1.11.2",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down

0 comments on commit a3026f4

Please sign in to comment.