fix(webui): open threads at latest message (#5142)

This commit is contained in:
chengyongru
2026-07-28 18:52:34 +08:00
committed by GitHub
parent 0c6c0438d4
commit 24a392b671
5 changed files with 232 additions and 3 deletions
+9 -1
View File
@@ -186,12 +186,20 @@ export class ThreadCameraController {
}
const deltaSeconds = deltaMs / 1000;
const nextTop = easeOutChase(
const easedTop = easeOutChase(
current,
this.target,
deltaSeconds,
motion,
);
// Some browsers quantize scrollTop writes to whole pixels. Keep the
// ease-out curve, but never let its subpixel tail round back to the same
// position forever.
const minimumStep = Math.min(1, Math.abs(remainingDistance));
const nextTop =
Math.abs(easedTop - current) < minimumStep
? current + Math.sign(remainingDistance) * minimumStep
: easedTop;
const settled = Math.abs(this.target - nextTop) <= motion.settleDistancePx;
this.write(viewport, settled ? this.target : nextTop);