Skip to content

Commit

Permalink
fix: Add viewOperation render data judgment
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerwin-L committed Jan 10, 2022
1 parent 6976a51 commit b35a123
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/lb-annotation/src/core/toolOperation/ViewOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b35a123

Please sign in to comment.