diff options
Diffstat (limited to 'addons/pdf/pdf.zig')
| -rw-r--r-- | addons/pdf/pdf.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/pdf/pdf.zig b/addons/pdf/pdf.zig index c9a49b7c..1e0fb311 100644 --- a/addons/pdf/pdf.zig +++ b/addons/pdf/pdf.zig @@ -1209,7 +1209,12 @@ fn layout(st: *Pdf, l: *Layout, k: usize) void { } if (l.rev != st.rev) { // a pixel's: P:F rounds const sp = stripOf(st, ownOf(st), k); - l.top = @round(f64Of(sp.y[st.page]) + std.math.clamp(st.frac, 0, 1) * f64Of(sp.ph[st.page])); + // Laid as the active view is (a window of its size in another + // process): the active's top as it is, a fraction and all, so the + // two show the same pixels (from P:F, rounded, one showed its page + // a pixel off the other's). + const same = if (pixels(st, st.active)) |a| a != l and a.rev == st.rev and a.vw == vw and a.vh == vh and a.fit == l.fit else false; + l.top = if (same) st.views[st.active - 1].top else @round(f64Of(sp.y[st.page]) + std.math.clamp(st.frac, 0, 1) * f64Of(sp.ph[st.page])); l.rev = st.rev; } l.top = std.math.clamp(l.top, 0, f64Of(l.height -| l.vh)); |
