Skip to content

Commit

Permalink
feat: Improve polygon drawing UX. #1597
Browse files Browse the repository at this point in the history
  • Loading branch information
mturoci committed Oct 3, 2022
1 parent 8712e3c commit 78e7b9a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/src/image_annotator_polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ export class PolygonAnnotator {
this.ctx.beginPath()
this.ctx.moveTo(points[0].x, points[0].y)

points.forEach(({ x, y }) => this.drawLine(x, y))
const _points = this.draggedPoint ? points.filter(p => !p.isAux) : points

_points.forEach(({ x, y }) => this.drawLine(x, y))
if (joinLastPoint) this.drawLine(points[0].x, points[0].y)

if (isFocused) {
this.ctx.fillStyle = color.substring(0, color.length - 2) + '0.2)'
this.ctx.fill()
points.forEach(({ x, y, isAux }) => this.drawPoint(x, y, isAux))
_points.forEach(({ x, y, isAux }) => this.drawPoint(x, y, isAux))
}
}

Expand Down

0 comments on commit 78e7b9a

Please sign in to comment.