Keep heatmap depth labels readable while scaling overlay

This commit is contained in:
Mike Cao
2026-06-22 22:32:05 -07:00
parent 7d84c84d9a
commit ce3d928f77
2 changed files with 11 additions and 1 deletions
@@ -123,6 +123,10 @@
border-radius: 4px;
padding: 1px 6px;
white-space: nowrap;
/* Counter-scaled inline via transform: scale(1 / fit.scale). Anchor to the
top-right corner (where the band right-aligns it) so it grows inward and
stays pinned to the edge instead of drifting off-canvas. */
transform-origin: top right;
}
.canvasWrapper {
@@ -853,7 +853,13 @@ function ScrollHeatmapView({
}}
title={`${band.toPct}% depth - ${formatLongNumber(band.reached)} sessions reached`}
>
<span className={styles.scrollBandLabel}>
<span
className={styles.scrollBandLabel}
// Counter-scale the label by the inverse of the canvas
// scale so its on-screen size stays constant while the
// bands resize with the rest of the overlay.
style={{ transform: `scale(${1 / fit.scale})` }}
>
{band.toPct}% depth - {Math.round(intensity * 100)}% reached
</span>
</div>