pixelBounds static method
Bounds in pixels, including text that grew beyond the drawn box.
Implementation
static Rect pixelBounds(UDocShape shape, UDocShapeGeometry geometry) {
final List<Offset> points = shape.points.map(geometry.toPixels).toList();
if (points.isEmpty) return Rect.zero;
if (shape.kind == UDocShapeKind.stickyNote) {
final double size = stickySize(geometry);
return Rect.fromLTWH(points.first.dx, points.first.dy, size, size);
}
Rect rect = geometry.rectToPixels(shape.bounds);
if (shape.kind == UDocShapeKind.textBox) {
final TextPainter text = textPainter(shape, geometry, rect.width);
rect = Rect.fromLTWH(rect.left, rect.top, rect.width, max(rect.height, text.height));
text.dispose();
}
final double pad = max(0.8, geometry.lengthToPixels(shape.strokeWidth)) / 2;
return rect.inflate(pad);
}