contains method

  1. @override
bool contains(
  1. CellOffset position
)
override

Returns true if the givenposition is within this range.

Implementation

@override
bool contains(CellOffset position) {
  var begin = this.begin;
  var end = this.end;

  if (!isNormalized) {
    end = this.begin;
    begin = this.end;
  }
  if (!(begin.y <= position.y && position.y <= end.y)) {
    return false;
  }

  final startX = min(begin.x, end.x);
  final endX = max(begin.x, end.x);
  return startX <= position.x && position.x <= endX;
}