automaticValuePosition method

ValuePosition automaticValuePosition(
  1. PdfPoint point,
  2. PdfPoint size,
  3. PdfPoint? previous,
  4. PdfPoint? next,
)

Implementation

ValuePosition automaticValuePosition(
  PdfPoint point,
  PdfPoint size,
  PdfPoint? previous,
  PdfPoint? next,
) {
  // Usually on top, except on the edges

  if (point.x - size.x / 2 < box!.left) {
    return ValuePosition.right;
  }

  if (point.x + size.x / 2 > box!.right) {
    return ValuePosition.left;
  }

  if (point.y + size.y + delta > box!.top) {
    return ValuePosition.bottom;
  }

  return ValuePosition.top;
}