MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / tooltipCover

Function tooltipCover

graph-ui/tools/lib/readability.mjs:788–854  ·  view source on GitHub ↗
(page, index)

Source from the content-addressed store, hash-verified

786 * ein Lauf, der sofort nachschaut, sieht die erste, unsichtbare Lage.
787 */
788export async function tooltipCover(page, index) {
789 return page.evaluate(({ at, protectSelector }) => {
790 const box = document.querySelector('[data-testid="atlas-hint"]');
791 if (box === null) {
792 return { open: false, covers: [], rect: null, name: '' };
793 }
794 const style = window.getComputedStyle(box);
795 const rect = box.getBoundingClientRect();
796 if (style.visibility === 'hidden' || rect.width <= 0 || rect.height <= 0) {
797 return { open: false, covers: [], rect: null, name: box.getAttribute('data-hint-for') ?? '' };
798 }
799 const trigger = document.querySelector(`[data-hint-index="${at}"]`);
800 const overlap = (other) => {
801 const width = Math.min(rect.right, other.right) - Math.max(rect.left, other.left);
802 const height = Math.min(rect.bottom, other.bottom) - Math.max(rect.top, other.top);
803 return width > 1 && height > 1 ? Math.round(width * height) : 0;
804 };
805 const covers = [];
806 const candidates = [...document.querySelectorAll(protectSelector)];
807 if (trigger !== null) {
808 candidates.push(trigger);
809 }
810 for (const node of candidates) {
811 if (node === box || box.contains(node) || node.contains(box)) {
812 continue;
813 }
814 // Dieselbe Regel wie `rendered` in src/ui/tooltip/Hint.tsx: der Inhalt eines zugeklappten <details> ist nicht zu sehen.
815 const closed = node.closest('details:not([open])');
816 if ((closed !== null && !(closed.querySelector(':scope > summary')?.contains(node) ?? false))
817 || (typeof node.checkVisibility === 'function' && !node.checkVisibility())) {
818 continue;
819 }
820 const other = node.getBoundingClientRect();
821 if (other.width <= 0 || other.height <= 0) {
822 continue;
823 }
824 const nodeStyle = window.getComputedStyle(node);
825 if (nodeStyle.display === 'none' || nodeStyle.visibility === 'hidden') {
826 continue;
827 }
828 const area = overlap(other);
829 if (area > 0) {
830 covers.push({
831 what: node === trigger
832 ? 'its own trigger'
833 : node.getAttribute('data-hint-keep')
834 ?? node.getAttribute('data-testid')
835 ?? node.tagName.toLowerCase(),
836 area,
837 });
838 }
839 }
840 return {
841 open: true,
842 name: box.getAttribute('data-hint-for') ?? '',
843 side: box.getAttribute('data-side') ?? '',
844 text: (box.textContent ?? '').replace(/\s+/g, ' ').trim().slice(0, 90),
845 rect: {

Callers 2

sweepTooltipsFunction · 0.90
mainFunction · 0.90

Calls 3

protectedSelectorFunction · 0.85
overlapFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected