mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-29 20:47:32 -06:00
Go to page keeps the side gutter clear of the quick-action bar (part of #2665)
This commit is contained in:
@@ -2472,12 +2472,11 @@ pub fn document_area(app: &mut PdfCraftApp, index: usize, ui: &mut egui::Ui) {
|
||||
// to one side. A page already shown whole, or one filling the window's width, keeps the
|
||||
// scroll, so paging through a zoomed-in document stays on the same column. Otherwise a
|
||||
// page that fits is centred, and a wider one scrolled just far enough to fill the window.
|
||||
// The page counts with its side gutters, which keep its edge clear of the floating
|
||||
// quick-action bar as the layout does.
|
||||
let (x, w) = (view.last_scroll.x, avail.width());
|
||||
let target = if r.width() <= w {
|
||||
if r.left() >= x && r.right() <= x + w { x } else { r.center().x - w / 2.0 }
|
||||
} else {
|
||||
x.clamp(r.left(), r.right() - w)
|
||||
};
|
||||
let (left, right) = (r.left() - SIDE, r.right() + SIDE);
|
||||
let target = if right - left <= w { if left >= x && right <= x + w { x } else { r.center().x - w / 2.0 } } else { x.clamp(left, right - w) };
|
||||
if (target - x).abs() > 0.5 {
|
||||
scroll = scroll.horizontal_scroll_offset(target.clamp(0.0, (content_w - w).max(0.0)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user