@huridocs/react-text-selection-handler
Version:
React pdf handler allows to render a PDF and handle text selection and highlights.
6 lines • 424 B
JavaScript
export const domRectToSelectionRectangle = (rectangle, region) => {
const regionDomRect = region.getBoundingClientRect();
const regionId = region.getAttribute('data-region-selector-id');
return Object.assign({ top: rectangle.y - regionDomRect.y, left: rectangle.x - regionDomRect.x, width: rectangle.width, height: rectangle.height }, (regionId ? { regionId } : {}));
};
//# sourceMappingURL=TextSelection.js.map