axisDirectionIsReversed function

bool axisDirectionIsReversed(
  1. AxisDirection axisDirection
)

Returns whether traveling along the given axis direction visits coordinates along that axis in numerically decreasing order.

Specifically, returns true for AxisDirection.up and AxisDirection.left and false for AxisDirection.down and AxisDirection.right.

Implementation

bool axisDirectionIsReversed(AxisDirection axisDirection) {
  return switch (axisDirection) {
    AxisDirection.up   || AxisDirection.left  => true,
    AxisDirection.down || AxisDirection.right => false,
  };
}