import { getClientX, getClientY } from "../utils/editorUtils";
export function getTrackFromEvent(event, allTracks) {
  var trackContainers = document.querySelectorAll(".alignmentViewTrackContainer");
  var track;
  trackContainers.forEach(function (t) {
    var mouseX = getClientX(event) + document.body.scrollLeft;
    var mouseY = 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;
}