SelectNearest<D> constructor
SelectNearest<D> ({
- SelectionModelType selectionModelType = SelectionModelType.info,
- SelectionMode selectionMode = SelectionMode.expandToDomain,
- bool selectAcrossAllSeriesRendererComponents = true,
- bool selectClosestSeries = true,
- SelectionTrigger eventTrigger = SelectionTrigger.hover,
- int? maximumDomainDistancePx,
- 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;
}
}