MCPcopy Create free account
hub / github.com/dailydotdev/apps / measure

Function measure

packages/shared/src/hooks/comments/useScrollToHashComment.ts:72–84  ·  view source on GitHub ↗
(element: HTMLElement)

Source from the content-addressed store, hash-verified

70 };
71
72 const measure = (element: HTMLElement): number[] => {
73 const rect = element.getBoundingClientRect();
74 const parentRect = scrollParent?.getBoundingClientRect();
75 return [
76 rect.top - (parentRect?.top ?? 0),
77 rect.height,
78 parentRect?.top ?? 0,
79 scrollParent?.clientHeight ?? window.innerHeight,
80 scrollParent?.scrollHeight ?? document.documentElement.scrollHeight,
81 window.visualViewport?.offsetTop ?? 0,
82 window.visualViewport?.height ?? window.innerHeight,
83 ];
84 };
85
86 const tick = () => {
87 if (performance.now() >= deadline) {

Callers 1

tickFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected