Skip to content

Commit

Permalink
Merge pull request #1318 from opencv/bs/batch_of_fixes
Browse files Browse the repository at this point in the history
React UI: Batch of fixes
  • Loading branch information
ActiveChooN authored Mar 26, 2020
2 parents 6a4ccde + e478637 commit 76d0c6b
Show file tree
Hide file tree
Showing 18 changed files with 194 additions and 167 deletions.
6 changes: 1 addition & 5 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1208,11 +1208,7 @@ export class CanvasViewImpl implements CanvasView, Listener {

let shapeSizeElement: ShapeSizeElement | null = null;
let resized = false;
(shape as any).resize().on('resizestart', (e: any): void => {
if (e.detail.event.detail.event.button === 2) {
e.preventDefault();
return;
}
(shape as any).resize().on('resizestart', (): void => {
this.mode = Mode.RESIZE;
if (state.shapeType === 'rectangle') {
shapeSizeElement = displayShapeSize(this.adoptedContent, this.adoptedText);
Expand Down
5 changes: 5 additions & 0 deletions cvat-canvas/src/typescript/svg.patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ SVG.Element.prototype.resize = function constructor(...args: any): any {
if (!handler) {
originalResize.call(this, ...args);
handler = this.remember('_resizeHandler');
handler.resize = function(e: any) {
if (e.detail.event.button === 0) {
return handler.constructor.prototype.resize.call(this, e);
}
}
handler.update = function(e: any) {
this.m = this.el.node.getScreenCTM().inverse();
return handler.constructor.prototype.update.call(this, e);
Expand Down
11 changes: 7 additions & 4 deletions cvat-core/src/annotations-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,10 @@
for (const object of objectsForMerge) {
object.removed = true;
}
}, [...objectsForMerge.map((object) => object.clientID), trackModel.clientID]);
}, [
...objectsForMerge
.map((object) => object.clientID), trackModel.clientID,
], objectStates[0].frame);
}

split(objectState, frame) {
Expand Down Expand Up @@ -522,7 +525,7 @@
object.removed = true;
prevTrack.removed = false;
nextTrack.removed = false;
}, [object.clientID, prevTrack.clientID, nextTrack.clientID]);
}, [object.clientID, prevTrack.clientID, nextTrack.clientID], frame);
}

group(objectStates, reset) {
Expand Down Expand Up @@ -554,7 +557,7 @@
objectsForGroup.forEach((object, idx) => {
object.group = redoGroups[idx];
});
}, objectsForGroup.map((object) => object.clientID));
}, objectsForGroup.map((object) => object.clientID), objectStates[0].frame);

return groupIdx;
}
Expand Down Expand Up @@ -790,7 +793,7 @@
importedArray.forEach((object) => {
object.removed = false;
});
}, importedArray.map((object) => object.clientID));
}, importedArray.map((object) => object.clientID), objectStates[0].frame);
}

select(objectStates, x, y) {
Expand Down
7 changes: 4 additions & 3 deletions cvat-core/src/annotations-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ class AnnotationHistory {

get() {
return {
undo: this._undo.map((undo) => undo.action),
redo: this._redo.map((redo) => redo.action),
undo: this._undo.map((undo) => [undo.action, undo.frame]),
redo: this._redo.map((redo) => [redo.action, redo.frame]),
};
}

do(action, undo, redo, clientIDs) {
do(action, undo, redo, clientIDs, frame) {
const actionItem = {
clientIDs,
action,
undo,
redo,
frame,
};

this._undo = this._undo.slice(-MAX_HISTORY_LENGTH + 1);
Expand Down
Loading

0 comments on commit 76d0c6b

Please sign in to comment.