# all files / diagram-js/lib/util/ Event.js

81.82% Statements 9/11
68.75% Branches 11/16
100% Functions 4/4
81.82% Lines 9/11

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    708×
    360×

    348×

    519×

    354×
    354×

    370×

    370×

    370×

     function __stopPropagation(event) {
      if (!event || typeof event.stopPropagation !== 'function') {
        return;
      }

      event.stopPropagation();
    }

    export function getOriginal(event) {
      return event.originalEvent || event.srcEvent;
    }

    export function stopPropagation(event, immediate) {
      __stopPropagation(event, immediate);
      __stopPropagation(getOriginal(event), immediate);
    }

    export function toPoint(event) {

      Iif (event.pointers && event.pointers.length) {
        event = event.pointers[0];
      }

      Iif (event.touches && event.touches.length) {
        event = event.touches[0];
      }

      return event ? {
        x: event.clientX,
        y: event.clientY
      } : null;
    }