fix(cbz): smooth scrollbar/slider dragging — rAF-coalesce scroll handler, idle-debounced prefetch, frame-batched height corrections, PageHeights.setEst converges unseen pages to the first measured page size, page slider seeks instantly while scrubbing (no per-notch smooth-animation restart); restore lost ### Fixed header in changelog

This commit is contained in:
2026-09-07 23:13:04 +08:00
parent 065fde5b56
commit c6dfb92c76
4 changed files with 95 additions and 18 deletions
+8
View File
@@ -23,6 +23,14 @@ it("set 修正高度并平移后续 offset;返回增量;幂等", () => {
expect(ph.set(2, 150)).toBe(0);
});
it("setEst:重估默认页高,返回视口上方「未量高」页数,已量高页保留", () => {
const ph = new PageHeights(5, 100); // cum 顶部: 0,100,200,300,400
ph.set(0, 160); // 页0 实测 160 → cum 顶部: 0,160,260,360,460
expect(ph.setEst(140, 260)).toBe(1); // 顶部<260 且未量高:页1(160)。页0 已量高排除,页2(260)不<260
expect(ph.total()).toBe(160 + 4 * 140); // 页0 实测保留,其余按新估高
expect(ph.setEst(140, 9999)).toBe(0); // 同值幂等:est 不变直接 0
});
it("n=0 时一切归空", () => {
const ph = new PageHeights(0, 100);
expect(ph.total()).toBe(0);