diff --git a/packages/lb-annotation/src/core/toolOperation/ViewOperation.ts b/packages/lb-annotation/src/core/toolOperation/ViewOperation.ts index 3e7ebab10..2fe9c9c9f 100644 --- a/packages/lb-annotation/src/core/toolOperation/ViewOperation.ts +++ b/packages/lb-annotation/src/core/toolOperation/ViewOperation.ts @@ -282,6 +282,10 @@ export default class ViewOperation extends BasicToolOperation { } case 'polygon': { const polygon = annotation.annotation; + if (!(polygon?.pointList?.length >= 3)) { + return; + } + const { lineType = ELineTypes.Line } = polygon; const renderPolygon = AxisUtils.changePointListByZoom(polygon?.pointList ?? [], this.zoom, this.currentPos); const style = this.getSpecificStyle(polygon); @@ -345,9 +349,17 @@ export default class ViewOperation extends BasicToolOperation { case 'line': { const line = annotation.annotation; + if (!(line?.pointList?.length >= 2)) { + return; + } + const { lineType = ELineTypes.Line } = line; + const renderLine = AxisUtils.changePointListByZoom( + (line?.pointList as IPoint[]) ?? [], + this.zoom, + this.currentPos, + ); - const renderLine = AxisUtils.changePointListByZoom(line.pointList as IPoint[], this.zoom, this.currentPos); const style = this.getSpecificStyle(line); const newPointList = DrawUtils.drawPolygon(this.canvas, renderLine, { ...style,