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: Annotation view enhancements #1106

Merged
merged 25 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7a791f9
Keyframes navigation
bsekachev Jan 27, 2020
3795a24
Synchronized objects on canvas and in side panel
bsekachev Jan 27, 2020
1c75736
Fixed minor bug with collapse
bsekachev Jan 27, 2020
71a2478
Fixed css property 'pointer-events'
bsekachev Jan 27, 2020
f7fd38e
Drawn appearance block
bsekachev Jan 27, 2020
e064cfa
Removed extra force reflow
bsekachev Jan 28, 2020
c070540
Finished appearance block, fixed couple bugs
bsekachev Jan 28, 2020
0d09751
Improved save() in cvat-core, changed approach to highlight shapes
bsekachev Jan 29, 2020
73f1d05
Fixed exception in edit function, fixed filling for polylines and poi…
bsekachev Jan 29, 2020
c707e47
Added lock
bsekachev Jan 29, 2020
7214d11
Some fixes with points
bsekachev Jan 29, 2020
a1ed8b2
Minor appearance fixes
bsekachev Jan 29, 2020
16d4260
Fixed insert for points
bsekachev Jan 29, 2020
64c3d87
Fixed unit tests
bsekachev Jan 29, 2020
10874b7
Fixed control
bsekachev Jan 29, 2020
d27bd67
Fixed list size
bsekachev Jan 29, 2020
c0929f8
Added propagate
bsekachev Jan 30, 2020
23d8f92
Minor fix with attr saving
bsekachev Jan 30, 2020
09df778
Some div changed to buttons
bsekachev Jan 30, 2020
fde5b24
Locked some buttons for unimplemented functionalities
bsekachev Jan 30, 2020
9ba3e99
Statistics modal, changing a job status
bsekachev Jan 30, 2020
35f6ca4
Minor fix with shapes counting
bsekachev Jan 30, 2020
5dc62f9
Couple of fixes to improve visibility
bsekachev Jan 30, 2020
5cc20c4
Added fullscreen
bsekachev Jan 31, 2020
d3c843d
SVG Canvas -> HTML Canvas frame (#1113)
bsekachev Feb 3, 2020
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
5 changes: 3 additions & 2 deletions cvat-canvas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ Canvas itself handles:
Standard JS events are used.
```js
- canvas.setup
- canvas.activated => ObjectState
- canvas.deactivated
- canvas.activated => {state: ObjectState}
- canvas.clicked => {state: ObjectState}
- canvas.moved => {states: ObjectState[], x: number, y: number}
- canvas.find => {states: ObjectState[], x: number, y: number}
- canvas.drawn => {state: DrawnData}
- canvas.editstart
- canvas.edited => {state: ObjectState, points: number[]}
- canvas.splitted => {state: ObjectState}
- canvas.groupped => {states: ObjectState[]}
Expand Down
57 changes: 39 additions & 18 deletions cvat-canvas/src/scss/canvas.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,35 @@
}

.cvat_canvas_shape {
fill-opacity: 0.03;
stroke-opacity: 1;
}

polyline.cvat_canvas_shape {
fill-opacity: 0;
}

.cvat_shape_action_opacity {
fill-opacity: 0.5;
stroke-opacity: 1;
}

polyline.cvat_shape_action_opacity {
fill-opacity: 0;
}

.cvat_shape_drawing_opacity {
fill-opacity: 0.2;
stroke-opacity: 1;
}

polyline.cvat_shape_drawing_opacity {
fill-opacity: 0;
}

.cvat_shape_action_dasharray {
stroke-dasharray: 4 1 2 3;
}

.cvat_canvas_text {
font-weight: bold;
font-size: 1.2em;
Expand All @@ -27,51 +47,52 @@ polyline.cvat_canvas_shape {
stroke: red;
}

.cvat_canvas_shape_activated {
fill-opacity: 0.3;
}

.cvat_canvas_shape_grouping {
@extend .cvat_shape_action_dasharray;
@extend .cvat_shape_action_opacity;
fill: darkmagenta;
fill-opacity: 0.5;
}

polyline.cvat_canvas_shape_grouping {
@extend .cvat_shape_action_dasharray;
@extend .cvat_shape_action_opacity;
stroke: darkmagenta;
stroke-opacity: 1;
}

.cvat_canvas_shape_merging {
@extend .cvat_shape_action_dasharray;
@extend .cvat_shape_action_opacity;
fill: blue;
fill-opacity: 0.5;
}

polyline.cvat_canvas_shape_merging {
@extend .cvat_shape_action_dasharray;
@extend .cvat_shape_action_opacity;
stroke: blue;
}

polyline.cvat_canvas_shape_splitting {
@extend .cvat_shape_action_dasharray;
@extend .cvat_shape_action_opacity;
stroke: dodgerblue;
stroke-opacity: 1;
}

.cvat_canvas_shape_splitting {
@extend .cvat_shape_action_dasharray;
@extend .cvat_shape_action_opacity;
fill: dodgerblue;
fill-opacity: 0.5;
}

polyline.cvat_canvas_shape_merging {
stroke: blue;
stroke-opacity: 1;
}

.cvat_canvas_shape_drawing {
fill-opacity: 0.1;
stroke-opacity: 1;
@extend .cvat_shape_drawing_opacity;
fill: white;
stroke: black;
}

.cvat_canvas_zoom_selection {
@extend .cvat_shape_action_dasharray;
stroke: #096dd9;
fill-opacity: 0;
stroke-dasharray: 4;
}

.cvat_canvas_shape_occluded {
Expand Down
4 changes: 2 additions & 2 deletions cvat-canvas/src/typescript/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import '../scss/canvas.scss';
interface Canvas {
html(): HTMLDivElement;
setup(frameData: any, objectStates: any[]): void;
activate(clientID: number, attributeID?: number): void;
activate(clientID: number | null, attributeID?: number): void;
rotate(rotation: Rotation, remember?: boolean): void;
focus(clientID: number, padding?: number): void;
fit(): void;
Expand Down Expand Up @@ -85,7 +85,7 @@ class CanvasImpl implements Canvas {
this.model.zoomCanvas(enable);
}

public activate(clientID: number, attributeID: number | null = null): void {
public activate(clientID: number | null, attributeID: number | null = null): void {
this.model.activate(clientID, attributeID);
}

Expand Down
39 changes: 25 additions & 14 deletions cvat-canvas/src/typescript/canvasModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export enum Mode {
}

export interface CanvasModel {
readonly image: string;
readonly image: HTMLImageElement | null;
readonly objects: any[];
readonly gridSize: Size;
readonly focusData: FocusData;
Expand All @@ -127,7 +127,7 @@ export interface CanvasModel {
move(topOffset: number, leftOffset: number): void;

setup(frameData: any, objectStates: any[]): void;
activate(clientID: number, attributeID: number | null): void;
activate(clientID: number | null, attributeID: number | null): void;
rotate(rotation: Rotation, remember: boolean): void;
focus(clientID: number, padding: number): void;
fit(): void;
Expand All @@ -151,7 +151,7 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
activeElement: ActiveElement;
angle: number;
canvasSize: Size;
image: string;
image: HTMLImageElement | null;
imageID: number | null;
imageOffset: number;
imageSize: Size;
Expand Down Expand Up @@ -183,7 +183,7 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
height: 0,
width: 0,
},
image: '',
image: null,
imageID: null,
imageOffset: 0,
imageSize: {
Expand Down Expand Up @@ -291,22 +291,33 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
}

public setup(frameData: any, objectStates: any[]): void {
if (frameData.number === this.data.imageID) {
this.data.objects = objectStates;
this.notify(UpdateReasons.OBJECTS_UPDATED);
return;
}

this.data.imageID = frameData.number;
frameData.data(
(): void => {
this.data.image = '';
this.data.image = null;
this.notify(UpdateReasons.IMAGE_CHANGED);
},
).then((data: string): void => {
).then((data: HTMLImageElement): void => {
if (frameData.number !== this.data.imageID) {
// already another image
return;
}

if (!this.data.rememberAngle) {
this.data.angle = 0;
}

this.data.imageSize = {
height: (frameData.height as number),
width: (frameData.width as number),
};

if (this.data.imageID !== frameData.number && !this.data.rememberAngle) {
this.data.angle = 0;
}
this.data.imageID = frameData.number;

this.data.image = data;
this.notify(UpdateReasons.IMAGE_CHANGED);
this.data.objects = objectStates;
Expand All @@ -316,8 +327,8 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
});
}

public activate(clientID: number, attributeID: number | null): void {
if (this.data.mode !== Mode.IDLE) {
public activate(clientID: number | null, attributeID: number | null): void {
if (this.data.mode !== Mode.IDLE && clientID !== null) {
// Exception or just return?
throw Error(`Canvas is busy. Action: ${this.data.mode}`);
}
Expand Down Expand Up @@ -503,7 +514,7 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
));
}

public get image(): string {
public get image(): HTMLImageElement | null {
return this.data.image;
}

Expand Down
Loading