touchStart method

void touchStart(
  1. TouchEvent event
)

Handles touch start events on either slider knob.

Implementation

void touchStart(TouchEvent event) {
  if (disabled) return;
  event.preventDefault();
  final touch = event.targetTouches!.first;
  _setValueToMousePosition(touch.page.x as int);
  isDragging = true;
  _changeDetector.markForCheck();
  final touchMoveSubscription = document.onTouchMove.listen((event) {
    event.preventDefault();
    final touch = event.targetTouches!.first;
    _setValueToMousePosition(touch.page.x as int);
  });
  document.onTouchEnd.take(1).listen((event) {
    event.preventDefault();
    touchMoveSubscription.cancel();
    isLeftKnobSelected = false;
    isRightKnobSelected = false;
    isDragging = false;
    _changeDetector.markForCheck();
  });
}