MCPcopy
hub / github.com/benjitaylor/agentation / hoverElement

Function hoverElement

package/example/src/app/components/FeaturesDemo.tsx:1671–1700  ·  view source on GitHub ↗
(
      element: string,
      ref: React.RefObject<HTMLElement | null>,
      preferBelow = false,
      duration: number = 1600
    )

Source from the content-addressed store, hash-verified

1669 let cancelled = false;
1670
1671 const hoverElement = async (
1672 element: string,
1673 ref: React.RefObject<HTMLElement | null>,
1674 preferBelow = false,
1675 duration: number = 1600
1676 ) => {
1677 if (cancelled) return;
1678 setShowLabel(false);
1679 setActiveElement(null);
1680 setActiveCaption(element);
1681
1682 const pos = getElementPosition(ref, preferBelow);
1683 if (!pos) return;
1684
1685 setCursorPos({ x: pos.cursorX, y: pos.cursorY });
1686
1687 await delay(400);
1688 if (cancelled) return;
1689
1690 setActiveElement(element);
1691 setLabelPos({ x: pos.labelX, y: pos.labelY, below: pos.below });
1692 setShowLabel(true);
1693
1694 await delay(duration);
1695 if (cancelled) return;
1696
1697 setShowLabel(false);
1698 setActiveElement(null);
1699 await delay(60);
1700 };
1701
1702 const runAnimation = async () => {
1703 setCursorPos({ x: 100, y: 80 });

Callers 1

runAnimationFunction · 0.85

Calls 2

getElementPositionFunction · 0.85
delayFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…