()
| 2851 | } |
| 2852 | |
| 2853 | function updateReportAnnotationToolbar() { |
| 2854 | const toolbar = document.querySelector(".annotation-toolbar"); |
| 2855 | const body = $("reportViewerBody"); |
| 2856 | const selection = window.getSelection(); |
| 2857 | if (!toolbar || !body || body.classList.contains("empty") || !selection || selection.rangeCount === 0 || selection.isCollapsed) { |
| 2858 | hideReportAnnotationToolbar(); |
| 2859 | return; |
| 2860 | } |
| 2861 | const range = selection.getRangeAt(0); |
| 2862 | if (!body.contains(range.commonAncestorContainer)) { |
| 2863 | hideReportAnnotationToolbar(); |
| 2864 | return; |
| 2865 | } |
| 2866 | state.reportAnnotationRange = range.cloneRange(); |
| 2867 | const rect = range.getBoundingClientRect(); |
| 2868 | if (!rect.width && !rect.height) { |
| 2869 | hideReportAnnotationToolbar(); |
| 2870 | return; |
| 2871 | } |
| 2872 | toolbar.classList.add("visible"); |
| 2873 | const toolbarRect = toolbar.getBoundingClientRect(); |
| 2874 | const left = Math.max(8, Math.min(window.innerWidth - toolbarRect.width - 8, rect.left + rect.width / 2 - toolbarRect.width / 2)); |
| 2875 | const top = Math.max(8, rect.top - toolbarRect.height - 8); |
| 2876 | toolbar.style.left = `${left}px`; |
| 2877 | toolbar.style.top = `${top}px`; |
| 2878 | } |
| 2879 | |
| 2880 | function selectedReportAnnotationRange() { |
| 2881 | const body = $("reportViewerBody"); |
nothing calls this directly
no test coverage detected