rectToTopLeft method

PdfTopLeftRect rectToTopLeft(
  1. PdfRect rect
)

Converts a rectangle from the user space to "top-left" coordinates.

Implementation

PdfTopLeftRect rectToTopLeft(PdfRect rect) {
  final a = pointToTopLeft(rect.left, rect.top);
  final b = pointToTopLeft(rect.right, rect.bottom);
  final left = math.min(a.x, b.x);
  final top = math.min(a.y, b.y);
  return PdfTopLeftRect(
    left,
    top,
    (a.x - b.x).abs(),
    (a.y - b.y).abs(),
  );
}