SelectNearest<D> constructor

SelectNearest<D>({
  1. SelectionModelType selectionModelType = SelectionModelType.info,
  2. SelectionMode selectionMode = SelectionMode.expandToDomain,
  3. bool selectAcrossAllSeriesRendererComponents = true,
  4. bool selectClosestSeries = true,
  5. SelectionTrigger eventTrigger = SelectionTrigger.hover,
  6. int? maximumDomainDistancePx,
  7. int? hoverEventDelay,
})

Implementation

SelectNearest(
    {this.selectionModelType = SelectionModelType.info,
    this.selectionMode = SelectionMode.expandToDomain,
    this.selectAcrossAllSeriesRendererComponents = true,
    this.selectClosestSeries = true,
    this.eventTrigger = SelectionTrigger.hover,
    this.maximumDomainDistancePx,
    this.hoverEventDelay}) {
  // Setup the appropriate gesture listening.
  switch (eventTrigger) {
    case SelectionTrigger.tap:
      _listener = GestureListener(onTapTest: _onTapTest, onTap: _onSelect);
      break;
    case SelectionTrigger.tapAndDrag:
      _listener = GestureListener(
        onTapTest: _onTapTest,
        onTap: _onSelect,
        onDragStart: _onSelect,
        onDragUpdate: _onSelect,
      );
      break;
    case SelectionTrigger.pressHold:
      _listener = GestureListener(
          onTapTest: _onTapTest,
          onLongPress: _onSelect,
          onDragStart: _onSelect,
          onDragUpdate: _onSelect,
          onDragEnd: _onDeselectAll);
      break;
    case SelectionTrigger.longPressHold:
      _listener = GestureListener(
          onTapTest: _onTapTest,
          onLongPress: _onLongPressSelect,
          onDragStart: _onSelect,
          onDragUpdate: _onSelect,
          onDragEnd: _onDeselectAll);
      break;
    case SelectionTrigger.hover:
    default:
      _listener = GestureListener(
          onHover: hoverEventDelay == null
              ? _onSelect
              : throttle<Point<double>, bool>(_onSelect,
                  delay: Duration(milliseconds: hoverEventDelay!),
                  defaultReturn: false));
      break;
  }
}