Skip to content

Commit

Permalink
Add disabler for autosnap when resizing
Browse files Browse the repository at this point in the history
Cleaned the code

Removed console logs and unused variables

Added comments to indicate code for bug fixes and for tracking feature

Cleaned the code

Removed comments on features coming from opencv/cvat

Merged tracking feature from old_jeff to jeff

Clean some code

Changed scroll while tracking can now change size/width/height

Middle mouse click switches between scroll to change size/width/height

Fix tracking only finishes on left click, not middle(scroll) click or right click

Add scroll to increase/decrease box size while tracking

Add box following mouse while tracking

Connect tracking feature in cvat-canvas and cvat-ui

Add tracking feature in cvat-canvas

Add new props (tracking, trackedStateID)

Added shortcut 't' to for tracking

Cleaned the code

Remove unused function

Uncommented code that triggers user story 2

Interpolate using resized frames while tracking

Fix box size resets when leaving and reentering frame while tracking
  • Loading branch information
elcie3 authored and meyg8600 committed Apr 27, 2020
1 parent 9c0d2c1 commit 138e53f
Show file tree
Hide file tree
Showing 15 changed files with 591 additions and 242 deletions.
9 changes: 9 additions & 0 deletions cvat-canvas/src/typescript/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ interface Canvas {

mode(): Mode;
cancel(): void;
// EDITED FOR USER STORY 12/13
trackObject(enable: boolean, objectID: number | null): void;
// EDITED END
configure(configuration: Configuration): void;
}

Expand All @@ -74,6 +77,12 @@ class CanvasImpl implements Canvas {
return this.view.html();
}

// EDITED FOR USER STORY 12/13
public trackObject(enable: boolean, objectID: number | null): void {
this.model.trackObject(enable, objectID);
}
// EDITED END

public setZLayer(zLayer: number | null): void {
this.model.setZLayer(zLayer);
}
Expand Down
12 changes: 12 additions & 0 deletions cvat-canvas/src/typescript/canvasController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export interface CanvasController {
drag(x: number, y: number): void;
disableDrag(): void;
fit(): void;

trackingElement: any; // EDITED FOR USER STORY 12/13
}

export class CanvasControllerImpl implements CanvasController {
Expand Down Expand Up @@ -147,4 +149,14 @@ export class CanvasControllerImpl implements CanvasController {
public get mode(): Mode {
return this.model.mode;
}

// EDITED FOR USER STORY 12/13
public set trackingElement(value: any) {
this.model.trackingElement = value;
}

public get trackingElement(): any {
return this.model.trackingElement;
}
// EDITED END
}
82 changes: 82 additions & 0 deletions cvat-canvas/src/typescript/canvasModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export enum UpdateReasons {
DRAG_CANVAS = 'drag_canvas',
ZOOM_CANVAS = 'zoom_canvas',
CONFIG_UPDATED = 'config_updated',
SWITCH_TRACKING = 'SWITCH_TRACKING', // EDITED START FOR USER STORY 12/13
}

export enum Mode {
Expand Down Expand Up @@ -163,6 +164,12 @@ export interface CanvasModel {

configure(configuration: Configuration): void;
cancel(): void;


// EDITED FOR USER STORY 12/13
trackObject(enable: boolean, trackedStateID: number | null): void;
trackingElement: any;
// EDITED END
}

export class CanvasModelImpl extends MasterImpl implements CanvasModel {
Expand All @@ -189,6 +196,24 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
splitData: SplitData;
selected: any;
mode: Mode;
// EDITED START FOR USER STORY 12/13
trackingElement: {
enable: boolean;
trackID: number | null;
mousecoords: any[];
scalemode: number;
trackrect: any | null;
trackedStates: any[];
trackedframes: any[];
trackedcentroids: any[];
trackedwidthheight: any[];
interpolatekeyframes: any[];
frameindex: {
frame: number | null;
index: number | null;
}
}
// EDITED END
};

public constructor() {
Expand Down Expand Up @@ -244,9 +269,56 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
},
selected: null,
mode: Mode.IDLE,

// EDITED START FOR USER STORY 12/13
trackingElement: {
enable: false,
trackID: null,
trackrect: null,
mousecoords: [],
scalemode: 0,
trackedStates: [],
trackedframes: [],
trackedcentroids: [],
trackedwidthheight: [],
interpolatekeyframes: [],
frameindex: {
frame: null,
index: null,
}
}
// EDITED END
};
}

// EDITED FOR USER STORY 12/13
public trackObject(enable: boolean, trackedStateID: number | null): void {
if (enable) {
this.trackingElement.enable = true;
this.data.trackingElement.trackID = trackedStateID;
} else {
this.data.trackingElement = {
enable: false,
trackID: null,
mousecoords: this.data.trackingElement.mousecoords,
scalemode: 0,
trackrect: this.data.trackingElement.trackrect,
trackedStates: [],
trackedframes: [],
trackedcentroids: [],
trackedwidthheight: [],
interpolatekeyframes: [],
frameindex: {
frame: null,
index: null,
}
}
}

this.notify(UpdateReasons.SWITCH_TRACKING);
}
// EDITED END

public setZLayer(zLayer: number | null): void {
this.data.zLayer = zLayer;
this.notify(UpdateReasons.SET_Z_LAYER);
Expand Down Expand Up @@ -631,4 +703,14 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
public get mode(): Mode {
return this.data.mode;
}

// EDITED FOR USER STORY 12/13
public set trackingElement(value: any) {
this.data.trackingElement = value;
}

public get trackingElement(): any {
return this.data.trackingElement;
}
// EDITED END
}
Loading

0 comments on commit 138e53f

Please sign in to comment.