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

Function settleLens

packages/shared/src/components/shell/ShellCluster.tsx:325–341  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

323
324 // The lens lets go: it settles onto the chosen tab on the light spring.
325 const settleLens = (index: number) => {
326 stopLens();
327 const pill = pillRef.current;
328 const track = trackRef.current;
329 if (!pill || !track) {
330 return;
331 }
332 const width = track.offsetWidth / tabs.length;
333 pill.style.transition = `transform ${settle.duration}ms ${settle.easing}`;
334 pill.style.transform = `translateX(${index * width}px)`;
335 const clear = () => {
336 pill.style.transition = '';
337 pill.style.transform = '';
338 pill.removeEventListener('transitionend', clear);
339 };
340 pill.addEventListener('transitionend', clear);
341 };
342
343 const onPointerMove = (event: React.PointerEvent<HTMLDivElement>) => {
344 const { current } = pointer;

Callers 1

endDragFunction · 0.85

Calls 1

stopLensFunction · 0.85

Tested by

no test coverage detected