inBounds static method

bool inBounds(
  1. HexCoordinate hex,
  2. int minCol,
  3. int maxCol,
  4. int minRow,
  5. int maxRow,
  6. bool isPointy,
)

检查坐标是否在矩形范围内

Implementation

static bool inBounds(
  HexCoordinate hex,
  int minCol,
  int maxCol,
  int minRow,
  int maxRow,
  bool isPointy,
) {
  final (col, row) = isPointy ? hex.toOffsetPointy() : hex.toOffsetFlat();
  return col >= minCol && col <= maxCol && row >= minRow && row <= maxRow;
}