src/a11y/insertElementWithinElement.js
function textLayerElementFromPoint(x, y, pageNumber) {
  let svg = document.querySelector(`svg[data-pdf-annotate-page="${pageNumber}"]`);
  let rect = svg.getBoundingClientRect();
  y = scaleUp(svg, {y}).y + rect.top;
  x = scaleUp(svg, {x}).x + rect.left;
  return [...svg.parentNode.querySelectorAll('.textLayer [data-canvas-width]')].filter((el) => {
    return pointIntersectsRect(x, y, el.getBoundingClientRect());
  })[0];
}
function textLayerElementFromPoint(x, y, pageNumber) {
  let svg = document.querySelector(`svg[data-pdf-annotate-page="${pageNumber}"]`);
  let rect = svg.getBoundingClientRect();
  y = scaleUp(svg, {y}).y + rect.top;
  x = scaleUp(svg, {x}).x + rect.left;
  return [...svg.parentNode.querySelectorAll('.textLayer [data-canvas-width]')].filter((el) => {
    return pointIntersectsRect(x, y, el.getBoundingClientRect());
  })[0];
}
function textLayerElementFromPoint ( x , y , pageNumber ) { let svg = document . querySelector ( ` ${ pageNumber } ` ) ; let rect = svg . getBoundingClientRect ( ) ; y = scaleUp ( svg , { y } ) . y + rect . top ; x = scaleUp ( svg , { x } ) . x + rect . left ; return [ ... svg . parentNode . querySelectorAll ( '.textLayer [data-canvas-width]' ) ] . filter ( ( el ) => { return pointIntersectsRect ( x , y , el . getBoundingClientRect ( ) ) ; } ) [ 0 ] ; }
Get a text layer element at a given point on a page

@param {Number} x The x coordinate of the point
@param {Number} y The y coordinate of the point
@param {Number} pageNumber The page to limit elements to
@return {Element} First text layer element found at the point
Get a text layer element at a given point on a page