Module reader_hud
Expand description
Shared reading-surface chrome for the document readers (ebook, pdf_viewer),
so both present the same selection affordances with the same spacing,
hover, and selected-state treatment:
SelectionHud— the floating toolbar shown while a passage is selected: a floating Panel (crate::widget::floating_surface) with the highlight colours asColorSwatchFaces and Copy / Note / Delete as plain buttons. Presentation + hit-testing only: each app owns the selection model and maps the emittedHudActionto its own command.MarkerDrag— the grab/track/threshold state a reader embeds to let an annotation marker be dragged, agnostic of the coordinate space (page points vs. screen-y).
Nothing here reaches into a document. The HUD is chrome, so it reads the window’s theme end to end; the reading palette stays on the page.
Structs§
- HudControls
- Which controls a
SelectionHudoffers besides the always-present Copy: the highlight swatch row, and the Note and Delete controls when enabled. - HudPlacement
- Where a
SelectionHudfloats:anchoris the horizontal centre and top-y of the selection’s first band,boundsthe area the bar must stay inside, both in the drawing transform’s space. - HudSwatch
- One highlight colour offered in the HUD’s swatch row.
- Marker
Drag - A reader begins a drag when a press lands on a marker it owns, tracks the pointer while held, and reads back the marker origin on release to persist the new anchor. Agnostic of the coordinate space (page points vs. screen-y) — the caller decides how to interpret the returned origin.
- Selection
Hud - A drawn
SelectionHud: its bounding rect plus the hit rects of its controls. Built fresh each frame bySelectionHud::draw; the caller either hit-tests it directly viaSelectionHud::hitor folds its buttons into its own hit list viaSelectionHud::buttons.
Enums§
- HudAction
- The swatch index in
HudAction::Highlightindexes into theswatchesslice passed toSelectionHud::draw; the caller maps it back to its own colour model. - HudSide
- Which side of the selection a
SelectionHudprefers.