axis method

double axis(
  1. Axis axis
)

The component along axis: x if horizontal, y if vertical.

Implementation

double axis(Axis axis) => axis == .horizontal ? x : y;