Skip to content

ASNT-110: Viewer: long-document navigation (page jump, page strip, fit width) #144

Closed

Description

@devnull03

Overview

The viewer reads a document one page at a time: ◀ ▶, PageUp/PageDown, or a search hit. On a 300-page scan an archivist cannot jump to a page they already know, cannot see where they are in the document, and has no way to fit a tall page to the frame's width. This task is the PDF phase that was split off from the viewer improvements in #142.

Scope

  • In scope: go to a page by number, a page thumbnail strip, and fit to width, in the overlay and in the pop-out viewer. These apply to PDFs and multi-page TIFFs, which are the two formats preview::page_count counts.
  • Out of scope:
    • Continuous scrolling through pages. It needs a virtualised list of rendered pages, which is a larger change.
    • Rotating a page while keeping search highlights on it. Today a rotated page shows no highlights.
    • Colour management (ICC profiles).

Task Details

  1. Go to page: make the "Page N of M" readout in the bottom pill editable. Enter jumps to the page and Escape cancels. Numbers are 1-based and clamped to the page count, and the jump goes through Viewer::show_page so the zoom and pan reset the same way they do today.
  2. Page strip: a collapsible column of page thumbnails. Each page is preview::source(path, CARD, page, 0), so the pages are cached on disk and counted in the memory budget. The strip scrolls to keep the current page in view, and a click calls show_page.
    • Use a virtualised list (uniform_list), because a 300-page document must not render 300 thumbnails at once.
    • In the pop-out, decide whether the strip lives in the stage or as a sidebar tab next to Details | Find.
  3. Fit to width: a zoom preset beside the fit/1:1 readout, with the pan starting at the top of the page. This needs the page's aspect ratio. preview::dimensions returns None for a PDF, so read the page size from PDFium, the same way pdf::decode does.

Definition of Done

  • Typing a page number jumps to that page. Values out of range are clamped.
  • The page strip shows every page without rendering pages that are off screen. The current page is highlighted and stays scrolled into view.
  • Fit to width works on PDFs and TIFF stacks.
  • All three work in the overlay and in the pop-out.
  • Tests for the page-jump parsing and clamping, and for fit-to-width zoom. ./scripts/ci.sh passes.

Estimate

About 1–1.5 days.

Type

Feature

Notion: https://app.notion.com/p/Viewer-long-document-navigation-page-jump-page-strip-fit-width-3e921d32b13b81e2ae04d612d56cac51

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions