Skip to content

Commit

Permalink
Merge pull request #161 from xtreme1-io/hotfix-polyline
Browse files Browse the repository at this point in the history
Resolved the error that occurred when drawing a polyline
  • Loading branch information
jaggerwang authored Nov 1, 2023
2 parents c8afa1c + c4d3e36 commit d256805
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class PolylineTool extends BaseTool {
console.log('????');
this.poly.destroy();
this.poly = null;
this.lastLine.destroy();
this.lastLine?.destroy();
this.lastLine = null;
this.view.setDrawingState(false);
this.view.editor.state.status = StatusType.Default;
Expand Down Expand Up @@ -70,16 +70,18 @@ export class PolylineTool extends BaseTool {
}
done() {
if (this.poly.points.length < 2) return;
this.lastLine.destroy();
this.lastLine = null;
this.view.editor.state.status = StatusType.Default;
this.view.emit(Event.DIMENSION_CHANGE_AFTER);
this.poly.setPoints(this.poly.points);
// this.poly.shape.closed(true);
this.poly.finishDraw();
this.poly.updateAnchors();
this.poly.draw();
this.poly = null;

if (this.poly) {
this.poly.updateAnchors();
this.poly.draw();
this.poly = null;
this.lastLine.destroy();
this.lastLine = null;
this.view.editor.state.status = StatusType.Default;
this.view.emit(Event.DIMENSION_CHANGE_AFTER);
}
}
createShape(point) {
if (!this.poly) {
Expand Down
6 changes: 3 additions & 3 deletions frontend/image-tool/src/editor/ImageLabel/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ export const CONSTANT = {
ANCHORSELECTOR,
SOURCETYPE,
MODETYPE,
ANCHORRADIUS: 2.5,
ANCHORHOVERRADIUS: 3.5,
ANCHORRADIUS: 3,
ANCHORHOVERRADIUS: 5,
STROKEWIDTH: 1,
HITSTROKEWIDTH: 2,
HITSTROKEWIDTH: 3,
INVALIDFILLCOLOR: 'rgb(255, 0, 0)',
SELECTEDCOLOR: '#ff00e2',
HIGHLIGHTCOLOR: '#ff00e2',
Expand Down

0 comments on commit d256805

Please sign in to comment.