Skip to content

Commit

Permalink
fix(tools): do not create null area rectangles
Browse files Browse the repository at this point in the history
Fixes #32
  • Loading branch information
n-peugnet committed Nov 9, 2020
1 parent 34a000b commit 13f5508
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/class.area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ export class AreaRect extends AreaPoly {
}
}

isValidShape(): boolean {
return super.isValidShape() && !this.isNullArea();
}

private isNullArea(): boolean {
return this.coords[0].x == this.coords[1].x || this.coords[0].y == this.coords[3].y;
}

updateLastCoord(coord: Coord): this {
this.coords[1].x = coord.x
this.coords[2] = coord;
Expand Down

0 comments on commit 13f5508

Please sign in to comment.