fix(webui): align picker rows and browser surfaces

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-08 20:33:15 +08:00
1 parent bdb5b487b9
commit 883924febc
4 files changed
+20 -39

No files matched your search

@@ -62,19 +62,14 @@ export function SidebarSelectionHighlight({
const firstPosition = !positionedRef.current;
if (firstPosition) highlight.style.transitionProperty = "none";
// Align the paint origin and destination to layout pixels. A fractional
// origin rasterized before translation can leave seams beside row backgrounds.
const snap = Math.round;
const originLeft = snap(containerRect.left);
const originTop = snap(containerRect.top);
const targetLeft = snap(targetRect.left);
const targetTop = snap(targetRect.top);
highlight.style.left = `${originLeft - containerRect.left}px`;
highlight.style.top = `${originTop - containerRect.top}px`;
highlight.style.width = `${snap(targetRect.right) - targetLeft}px`;
highlight.style.height = `${snap(targetRect.bottom) - targetTop}px`;
highlight.style.transform = `translate3d(${targetLeft - originLeft}px, ${
targetTop - originTop
// Preserve fractional layout coordinates so the highlight shares the
// target's edges, including where it meets an adjacent hover background.
highlight.style.left = "0px";
highlight.style.top = "0px";
highlight.style.width = `${targetRect.width}px`;
highlight.style.height = `${targetRect.height}px`;
highlight.style.transform = `translate3d(${targetRect.left - containerRect.left}px, ${
targetRect.top - containerRect.top
}px, 0)`;
highlight.style.opacity = "1";
positionedRef.current = true;