src/synchronization/Synchronizer.js
function fireEvent(sourceElement, eventData) {
    const isDisabled = !that.enabled;
    const noElements = !sourceElements.length || !targetElements.length;

    if (isDisabled || noElements) {
      return;
    }

    ignoreFiredEvents = true;
    targetElements.forEach(function(targetElement) {
      const targetIndex = targetElements.indexOf(targetElement);

      if (targetIndex === -1) {
        return;
      }

      const targetImageId = initialData.imageIds.targetElements[targetIndex];
      const sourceIndex = sourceElements.indexOf(sourceElement);

      if (sourceIndex === -1) {
        return;
      }

      const sourceImageId = initialData.imageIds.sourceElements[sourceIndex];

      let positionDifference;

      if (sourceImageId === targetImageId) {
        positionDifference = 0;
      } else if (initialData.distances[sourceImageId] !== undefined) {
        positionDifference =
          initialData.distances[sourceImageId][targetImageId];
      }

      eventHandler(
        that,
        sourceElement,
        targetElement,
        eventData,
        positionDifference
      );
    });
    ignoreFiredEvents = false;
  }
function fireEvent(sourceElement, eventData) {
    const isDisabled = !that.enabled;
    const noElements = !sourceElements.length || !targetElements.length;

    if (isDisabled || noElements) {
      return;
    }

    ignoreFiredEvents = true;
    targetElements.forEach(function(targetElement) {
      const targetIndex = targetElements.indexOf(targetElement);

      if (targetIndex === -1) {
        return;
      }

      const targetImageId = initialData.imageIds.targetElements[targetIndex];
      const sourceIndex = sourceElements.indexOf(sourceElement);

      if (sourceIndex === -1) {
        return;
      }

      const sourceImageId = initialData.imageIds.sourceElements[sourceIndex];

      let positionDifference;

      if (sourceImageId === targetImageId) {
        positionDifference = 0;
      } else if (initialData.distances[sourceImageId] !== undefined) {
        positionDifference =
          initialData.distances[sourceImageId][targetImageId];
      }

      eventHandler(
        that,
        sourceElement,
        targetElement,
        eventData,
        positionDifference
      );
    });
    ignoreFiredEvents = false;
  }
function fireEvent ( sourceElement , eventData ) { const isDisabled = ! that . enabled ; const noElements = ! sourceElements . length || ! targetElements . length ; if ( isDisabled || noElements ) { return ; } ignoreFiredEvents = true ; targetElements . forEach ( function ( targetElement ) { const targetIndex = targetElements . indexOf ( targetElement ) ; if ( targetIndex === - 1 ) { return ; } const targetImageId = initialData . imageIds . targetElements [ targetIndex ] ; const sourceIndex = sourceElements . indexOf ( sourceElement ) ; if ( sourceIndex === - 1 ) { return ; } const sourceImageId = initialData . imageIds . sourceElements [ sourceIndex ] ; let positionDifference ; if ( sourceImageId === targetImageId ) { positionDifference = 0 ; } else if ( initialData . distances [ sourceImageId ] !== undefined ) { positionDifference = initialData . distances [ sourceImageId ] [ targetImageId ] ; } eventHandler ( that , sourceElement , targetElement , eventData , positionDifference ) ; } ) ; ignoreFiredEvents = false ; }
Gather necessary event data and call synchronization handler

@private
@param {HTMLElement} sourceElement - The source element for the event
@param {Object} eventData - The data object for the source event
@returns {void}
Gather necessary event data and call synchronization handler