internal void GetStops(int offset, int totalWidth, out ItemStop previous, out ItemStop current, out ItemStop next) { next = current = previous = null; if (VisibleChildren.Count == 0) { return; } int nextIndex = -1; int currentIndex = -1; int previousIndex = -1; int position = -offset % totalWidth; int itemStopIndex = 0; foreach (ItemStop itemStop in _itemStops) { if (itemStop.Position < position) { previousIndex = itemStopIndex; } else if (itemStop.Position > position) { nextIndex = itemStopIndex; break; } else if (itemStop.Position == position) { currentIndex = itemStopIndex; } ++itemStopIndex; } if (previousIndex != -1) { previous = _itemStops[previousIndex]; } if (currentIndex != -1) { current = _itemStops[currentIndex]; } if (nextIndex != -1) { next = _itemStops[nextIndex]; } }
internal void GetStops(int offset, int totalWidth, out ItemStop previous, out ItemStop current, out ItemStop next) { next = current = previous = null; if (VisibleChildren.Count == 0) { return; } int nextIndex = -1; int currentIndex = -1; int previousIndex = -1; int position = -offset % totalWidth; int itemStopIndex = 0; foreach (ItemStop itemStop in _itemStops) { if (itemStop.Position < position) { previousIndex = itemStopIndex; } else if (itemStop.Position > position) { nextIndex = itemStopIndex; break; } else if (itemStop.Position == position) { currentIndex = itemStopIndex; } ++itemStopIndex; } if (previousIndex != -1) { previous = _itemStops[previousIndex]; } if (currentIndex != -1) { current = _itemStops[currentIndex]; } if (nextIndex != -1) { next = _itemStops[nextIndex]; } }