"use strict";

exports.__esModule = true;
exports.getTrackFromEvent = getTrackFromEvent;
var _editorUtils = require("../utils/editorUtils");
function getTrackFromEvent(event, allTracks) {
  var trackContainers = document.querySelectorAll(".alignmentViewTrackContainer");
  var track;
  trackContainers.forEach(function (t) {
    var mouseX = (0, _editorUtils.getClientX)(event) + document.body.scrollLeft;
    var mouseY = (0, _editorUtils.getClientY)(event) + document.body.scrollTop;
    if (mouseX >= t.getBoundingClientRect().left && mouseX <= t.getBoundingClientRect().left + t.getBoundingClientRect().width && mouseY >= t.getBoundingClientRect().top && mouseY <= t.getBoundingClientRect().top + t.getBoundingClientRect().height) {
      var index = t.getAttribute("data-alignment-track-index");
      track = allTracks[index];
      track.index = index;
      return true;
    }
  });
  return track;
}