Skip to content

Commit

Permalink
Merge branch 'develop' into dk/codacy-stylelint
Browse files Browse the repository at this point in the history
  • Loading branch information
ActiveChooN committed Jun 23, 2020
2 parents 5f492a5 + 5556b8a commit f680304
Show file tree
Hide file tree
Showing 52 changed files with 1,647 additions and 856 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Better validation of labels and attributes in raw viewer (<https://github.com/opencv/cvat/pull/1727>)
- ClamAV antivirus integration (<https://github.com/opencv/cvat/pull/1712>)
- SCSS files linting with Stylelint tool (<https://github.com/opencv/cvat/pull/1766>)
- Supported import and export or single boxes in MOT format (https://github.com/opencv/cvat/pull/1764)
- [Datumaro] Added `stats` command, which shows some dataset statistics like image mean and std (https://github.com/opencv/cvat/pull/1734)
- Add option to upload annotations upon task creation on CLI
- Polygon and polylines interpolation (<https://github.com/opencv/cvat/pull/1571>)
- Ability to redraw shape from scratch (Shift + N) for an activated shape (<https://github.com/opencv/cvat/pull/1571>)
- Highlights for the first point of a polygon/polyline and direction (<https://github.com/opencv/cvat/pull/1571>)
- Ability to change orientation for poylgons/polylines in context menu (<https://github.com/opencv/cvat/pull/1571>)
- Ability to set the first point for polygons in points context menu (<https://github.com/opencv/cvat/pull/1571>)

### Changed
- Removed information about e-mail from the basic user information (<https://github.com/opencv/cvat/pull/1627>)
- Update https install manual. Makes it easier and more robust. Includes automatic renewing of lets encrypt certificates.
- Implemented import and export of annotations with relative image paths (<https://github.com/opencv/cvat/pull/1463>)
- Using only single click to start editing or remove a point (<https://github.com/opencv/cvat/pull/1571>)

### Deprecated
-
Expand Down
7 changes: 5 additions & 2 deletions cvat-canvas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Canvas itself handles:
mode(): Mode;
cancel(): void;
configure(configuration: Configuration): void;
isAbleToChangeFrame(): boolean;
}
```

Expand Down Expand Up @@ -188,8 +189,7 @@ Standard JS events are used.

| | IDLE | GROUP | SPLIT | DRAW | MERGE | EDIT | DRAG | RESIZE | ZOOM_CANVAS | DRAG_CANVAS |
|--------------|------|-------|-------|------|-------|------|------|--------|-------------|-------------|
| html() | + | + | + | + | + | + | + | + | + | + |
| setup() | + | + | + | + | + | +/- | +/- | +/- | + | + |
| setup() | + | + | + | +/- | + | +/- | +/- | +/- | + | + |
| activate() | + | - | - | - | - | - | - | - | - | - |
| rotate() | + | + | + | + | + | + | + | + | + | + |
| focus() | + | + | + | + | + | + | + | + | + | + |
Expand All @@ -208,3 +208,6 @@ Standard JS events are used.
| setZLayer() | + | + | + | + | + | + | + | + | + | + |

You can call setup() during editing, dragging, and resizing only to update objects, not to change a frame.
You can change frame during draw only when you do not redraw an existing object

Other methods do not change state and can be used everytime.
2 changes: 1 addition & 1 deletion cvat-canvas/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-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-canvas",
"version": "1.1.1",
"version": "1.2.0",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts",
"scripts": {
Expand Down
19 changes: 19 additions & 0 deletions cvat-canvas/src/scss/canvas.scss
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,25 @@ polyline.cvat_canvas_shape_splitting {
cursor: move;
}

.cvat_canvas_first_poly_point {
fill: lightgray;
}

.cvat_canvas_poly_direction {
fill: lightgray;
stroke: black;

&:hover {
fill: black;
stroke: lightgray;
}

&:active {
fill: lightgray;
stroke: black;
}
}

#cvat_canvas_wrapper {
width: calc(100% - 10px);
height: calc(100% - 10px);
Expand Down
5 changes: 5 additions & 0 deletions cvat-canvas/src/typescript/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ interface Canvas {
mode(): Mode;
cancel(): void;
configure(configuration: Configuration): void;
isAbleToChangeFrame(): boolean;
}

class CanvasImpl implements Canvas {
Expand Down Expand Up @@ -153,6 +154,10 @@ class CanvasImpl implements Canvas {
public configure(configuration: Configuration): void {
this.model.configure(configuration);
}

public isAbleToChangeFrame(): boolean {
return this.model.isAbleToChangeFrame();
}
}

export {
Expand Down
38 changes: 34 additions & 4 deletions cvat-canvas/src/typescript/canvasModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export interface DrawData {
numberOfPoints?: number;
initialState?: any;
crosshair?: boolean;
redraw?: number;
}

export interface EditData {
Expand Down Expand Up @@ -169,6 +170,7 @@ export interface CanvasModel {
dragCanvas(enable: boolean): void;
zoomCanvas(enable: boolean): void;

isAbleToChangeFrame(): boolean;
configure(configuration: Configuration): void;
cancel(): void;
}
Expand Down Expand Up @@ -382,10 +384,17 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
}

if (this.data.mode !== Mode.IDLE && clientID !== null) {
// Exception or just return?
throw Error(`Canvas is busy. Action: ${this.data.mode}`);
}

if (typeof (clientID) === 'number') {
const [state] = this.data.objects
.filter((_state: any): boolean => _state.clientID === clientID);
if (!['rectangle', 'polygon', 'polyline', 'points', 'cuboid'].includes(state.shapeType)) {
return;
}
}

this.data.activeElement = {
clientID,
attributeID,
Expand Down Expand Up @@ -465,10 +474,24 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
}
}

this.data.drawData = { ...drawData };
if (this.data.drawData.initialState) {
this.data.drawData.shapeType = this.data.drawData.initialState.shapeType;
if (typeof (drawData.redraw) === 'number') {
const clientID = drawData.redraw;
const [state] = this.data.objects
.filter((_state: any): boolean => _state.clientID === clientID);

if (state) {
this.data.drawData = { ...drawData };
this.data.drawData.shapeType = state.shapeType;
} else {
return;
}
} else {
this.data.drawData = { ...drawData };
if (this.data.drawData.initialState) {
this.data.drawData.shapeType = this.data.drawData.initialState.shapeType;
}
}

this.notify(UpdateReasons.DRAW);
}

Expand Down Expand Up @@ -548,6 +571,13 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
this.notify(UpdateReasons.CONFIG_UPDATED);
}

public isAbleToChangeFrame(): boolean {
const isUnable = [Mode.DRAG, Mode.EDIT, Mode.RESIZE].includes(this.data.mode)
|| (this.data.mode === Mode.DRAW && typeof (this.data.drawData.redraw) === 'number');

return !isUnable;
}

public cancel(): void {
this.notify(UpdateReasons.CANCEL);
}
Expand Down
Loading

0 comments on commit f680304

Please sign in to comment.