toggle-gesture.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { GESTURE_PRIORITY_TOGGLE, GESTURE_TOGGLE } from '../../gestures/gesture-controller';
  2. import { PanGesture } from '../../gestures/pan-gesture';
  3. import { pointerCoord } from '../../util/dom';
  4. /**
  5. * @hidden
  6. */
  7. export class ToggleGesture extends PanGesture {
  8. constructor(plt, toggle, gestureCtrl, domCtrl) {
  9. super(plt, toggle.getNativeElement(), {
  10. threshold: 0,
  11. zone: false,
  12. domController: domCtrl,
  13. gesture: gestureCtrl.createGesture({
  14. name: GESTURE_TOGGLE,
  15. priority: GESTURE_PRIORITY_TOGGLE
  16. })
  17. });
  18. this.toggle = toggle;
  19. }
  20. canStart() {
  21. return true;
  22. }
  23. onDragStart(ev) {
  24. ev.preventDefault();
  25. this.toggle._onDragStart(pointerCoord(ev).x);
  26. }
  27. onDragMove(ev) {
  28. ev.preventDefault();
  29. this.toggle._onDragMove(pointerCoord(ev).x);
  30. }
  31. onDragEnd(ev) {
  32. ev.preventDefault();
  33. this.toggle._onDragEnd(pointerCoord(ev).x);
  34. }
  35. }
  36. //# sourceMappingURL=toggle-gesture.js.map