createAligned2D<R extends Position> static method

R createAligned2D<R extends Position>(
  1. Box box,
  2. CreatePosition<R> factory, {
  3. Aligned align = Aligned.center,
})

Returns an aligned 2D position relative to box.

Implementation

static R createAligned2D<R extends Position>(
  Box box,
  CreatePosition<R> factory, {
  Aligned align = Aligned.center,
}) =>
    factory.call(
      x: box.minX + box.width * (1.0 + align.x) / 2.0,
      y: box.minY + box.height * (1.0 + align.y) / 2.0,
    );