Showing
5 changed files
with
13 additions
and
2 deletions
| @@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
| 12 | - Document.save() now returns a Future | 12 | - Document.save() now returns a Future |
| 13 | - Add Widget.draw() to paint any widget on a canvas | 13 | - Add Widget.draw() to paint any widget on a canvas |
| 14 | - Improve Chart labels | 14 | - Improve Chart labels |
| 15 | +- Improve BoxBorder correctness | ||
| 15 | 16 | ||
| 16 | ## 1.13.0 | 17 | ## 1.13.0 |
| 17 | 18 |
| @@ -582,6 +582,7 @@ class PdfGraphics { | @@ -582,6 +582,7 @@ class PdfGraphics { | ||
| 582 | 582 | ||
| 583 | /// Set line joint miter limit, applies if the | 583 | /// Set line joint miter limit, applies if the |
| 584 | void setMiterLimit(double limit) { | 584 | void setMiterLimit(double limit) { |
| 585 | + assert(limit >= 1.0); | ||
| 585 | PdfNum(limit).output(buf); | 586 | PdfNum(limit).output(buf); |
| 586 | buf.putString(' M\n'); | 587 | buf.putString(' M\n'); |
| 587 | } | 588 | } |
| @@ -14,6 +14,8 @@ | @@ -14,6 +14,8 @@ | ||
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | +import 'dart:math' as math; | ||
| 18 | + | ||
| 17 | import 'package:pdf/pdf.dart'; | 19 | import 'package:pdf/pdf.dart'; |
| 18 | import 'package:xml/xml.dart'; | 20 | import 'package:xml/xml.dart'; |
| 19 | 21 | ||
| @@ -225,7 +227,7 @@ class SvgPath extends SvgOperation { | @@ -225,7 +227,7 @@ class SvgPath extends SvgOperation { | ||
| 225 | ..drawShape(d) | 227 | ..drawShape(d) |
| 226 | ..setLineCap(brush.strokeLineCap) | 228 | ..setLineCap(brush.strokeLineCap) |
| 227 | ..setLineJoin(brush.strokeLineJoin) | 229 | ..setLineJoin(brush.strokeLineJoin) |
| 228 | - ..setMiterLimit(brush.strokeMiterLimit) | 230 | + ..setMiterLimit(math.max(1.0, brush.strokeMiterLimit)) |
| 229 | ..setLineDashPattern( | 231 | ..setLineDashPattern( |
| 230 | brush.strokeDashArray, brush.strokeDashOffset.toInt()) | 232 | brush.strokeDashArray, brush.strokeDashOffset.toInt()) |
| 231 | ..setLineWidth(brush.strokeWidth.sizeValue) | 233 | ..setLineWidth(brush.strokeWidth.sizeValue) |
| @@ -87,6 +87,8 @@ abstract class BoxBorder { | @@ -87,6 +87,8 @@ abstract class BoxBorder { | ||
| 87 | BorderSide side, BorderRadius borderRadius) { | 87 | BorderSide side, BorderRadius borderRadius) { |
| 88 | _setStyle(context, side.style); | 88 | _setStyle(context, side.style); |
| 89 | context.canvas | 89 | context.canvas |
| 90 | + ..setLineJoin(PdfLineJoin.miter) | ||
| 91 | + ..setMiterLimit(4) | ||
| 90 | ..setStrokeColor(side.color) | 92 | ..setStrokeColor(side.color) |
| 91 | ..setLineWidth(side.width); | 93 | ..setLineWidth(side.width); |
| 92 | borderRadius.paint(context, box); | 94 | borderRadius.paint(context, box); |
| @@ -98,6 +100,8 @@ abstract class BoxBorder { | @@ -98,6 +100,8 @@ abstract class BoxBorder { | ||
| 98 | Context context, PdfRect box, BorderSide side) { | 100 | Context context, PdfRect box, BorderSide side) { |
| 99 | _setStyle(context, side.style); | 101 | _setStyle(context, side.style); |
| 100 | context.canvas | 102 | context.canvas |
| 103 | + ..setLineJoin(PdfLineJoin.miter) | ||
| 104 | + ..setMiterLimit(4) | ||
| 101 | ..setStrokeColor(side.color) | 105 | ..setStrokeColor(side.color) |
| 102 | ..setLineWidth(side.width) | 106 | ..setLineWidth(side.width) |
| 103 | ..drawBox(box) | 107 | ..drawBox(box) |
| @@ -254,7 +258,10 @@ class Border extends BoxBorder { | @@ -254,7 +258,10 @@ class Border extends BoxBorder { | ||
| 254 | assert(borderRadius == null, | 258 | assert(borderRadius == null, |
| 255 | 'A borderRadius can only be given for a uniform Border.'); | 259 | 'A borderRadius can only be given for a uniform Border.'); |
| 256 | 260 | ||
| 257 | - context.canvas.setLineCap(PdfLineCap.square); | 261 | + context.canvas |
| 262 | + ..setLineCap(PdfLineCap.square) | ||
| 263 | + ..setMiterLimit(4) | ||
| 264 | + ..setLineJoin(PdfLineJoin.miter); | ||
| 258 | 265 | ||
| 259 | if (top.style != BorderStyle.none) { | 266 | if (top.style != BorderStyle.none) { |
| 260 | BoxBorder._setStyle(context, top.style); | 267 | BoxBorder._setStyle(context, top.style); |
No preview for this file type
-
Please register or login to post a comment