handlePreviousDomain method

  1. @protected
bool handlePreviousDomain()

Implementation

@protected
bool handlePreviousDomain() {
  // 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 last domain when current index is NO_SELECTION.
  if (_currentIndex == NO_SELECTION) {
    _currentIndex = domainsLength - 1;
  } else {
    // Navigate to the previous index, or to NO_SELECTION when it would
    // outreach the domain index.
    _currentIndex = _currentIndex == 0 ? NO_SELECTION : _currentIndex - 1;
  }

  _doNavigate(_currentIndex);

  return true;
}