handleNextDomain method

  1. @protected
bool handleNextDomain()

Implementation

@protected
bool handleNextDomain() {
  // Lazily initialize selection domains when a key is pressed after a draw.
  if (_datumPairs == null) {
    _generateSelectionDomains();
  }

  final domainsLength = _datumPairs!.length;
  if (domainsLength == 0) {
    return false;
  }

  _currentIndex = _getActiveHoverDomainIndex();

  // Navigate to the first domain when current index is NO_SELECTION.
  if (_currentIndex == NO_SELECTION) {
    _currentIndex = 0;
  } else {
    // Set to NO_SELECTION when the next index would outreach the domains.
    _currentIndex =
        _currentIndex == domainsLength - 1 ? NO_SELECTION : _currentIndex + 1;
  }

  _doNavigate(_currentIndex);

  return true;
}