All files / packages/tools/src/eventDispatchers/touchEventHandlers touchDrag.ts

0% Statements 0/7
0% Branches 0/6
0% Functions 0/1
0% Lines 0/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                                               
import getActiveToolForTouchEvent from '../shared/getActiveToolForTouchEvent';
import { state } from '../../store';
import { TouchDragEventType } from '../../types/EventTypes';
 
/**
 * touchDrag - Event handler for touchDrag events. Uses `customCallbackHandler` to fire
 * the `touchDragCallback` function on active tools.
 */
export default function touchDrag(evt: TouchDragEventType) {
  if (state.isInteractingWithTool) {
    return;
  }
 
  const activeTool = getActiveToolForTouchEvent(evt);
 
  const noFoundToolOrDoesNotHaveTouchDragCallback =
    !activeTool || typeof activeTool.touchDragCallback !== 'function';
  if (noFoundToolOrDoesNotHaveTouchDragCallback) {
    return;
  }
 
  activeTool.touchDragCallback(evt);
}