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

React UI: Batch of fixes #1318

Merged
merged 5 commits into from
Mar 26, 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
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