public ScreenRangeChangedEvent(IndexRange range) { this.Range = range; }
public IndexRange Intersect(IndexRange range) => CreateFromBeginAndEnd(Mathf.Max(this.Position, range.Position), Mathf.Min(this.EndPosition, range.EndPosition));
public bool Equals(IndexRange other) => (this.Position == other.Position) && (this.Count == other.Count);
public void CalculateDifference(IndexRange newRange, out IndexRange removedLow, out IndexRange removedHigh, out IndexRange addedLow, out IndexRange addedHigh) { removedLow = new IndexRange(); removedHigh = new IndexRange(); addedLow = new IndexRange(); addedHigh = new IndexRange(); if (newRange.Position > this.Position) { removedLow.Position = this.Position; removedLow.Count = Mathf.Min(newRange.Position, this.EndPosition + 1) - this.Position; } else if (newRange.Position < this.Position) { addedLow.Position = newRange.Position; addedLow.Count = Mathf.Min(this.Position, newRange.EndPosition + 1) - newRange.Position; } if (newRange.EndPosition < this.EndPosition) { removedHigh.Position = Mathf.Max(newRange.EndPosition + 1, this.Position); removedHigh.Count = (this.EndPosition - removedHigh.Position) + 1; } else if (newRange.EndPosition > this.EndPosition) { addedHigh.Position = Mathf.Max(this.EndPosition + 1, newRange.Position); addedHigh.Count = (newRange.EndPosition - addedHigh.Position) + 1; } }
private IndexRange CalculateScreenRange() => IndexRange.CreateFromBeginAndEnd(this.PositionToItemIndexUnclamped(this.position + 0.01f), this.PositionToItemIndexUnclamped((this.position + this.pageSize) - 0.01f));