mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-31 15:49:36 +00:00
Every page module set egui's cursor itself and the last write of a frame won, so the order of document_area's per-page chain decided the cursor, not what a press there does. The link hover loop ran last and showed the hand over any link for every tool but Fill & Sign, though only the Select tool follows links: a click with the stamp tool placed a stamp, a drag with the rectangle tool drew, and in Edit text a drag from linked words moved the paragraph, all under the hand. The text layer ran after the comments and showed the I-beam over a movable comment lying on text, which a drag there moves. Page modules now claim the cursor instead (src/page_cursor.rs): a layer, an icon and optionally a tip. The layers are the review's priority table, Editor > Handle > Placed > Field > Comment > Link > Text > tool area, with Drag on top for a drag in progress, whose owner names the cursor until the release. document_area resolves the claims once per frame, after the pages, and calls set_cursor_icon once: the claim on the highest layer the active tool reaches wins. Links count only for the Select tool (follow) and the Link tool (edit), comments only for the Select tool; the other layers are claimed only by the modules of the tools that act on them. The claims go into a per-frame collector on DocView, which every page module already takes, so the calls in the dispatch block keep their arguments (camera, content and redact lose a `ui` they took only for the cursor). A link's tip goes with its claim, so it shows only where the link wins: no longer with a stamp, drawing or other tool that does not follow links. A comment's tip is a description instead (comments::describe), shown with any tool beside that tool's cursor unless the winning claim has a tip of its own: Acrobat shows a comment's tooltip with every tool (observed with Select, Hand, Add comment, Highlight, Rectangle and Stamp). It keeps the old exceptions (Fill & Sign, freehand drawing for #429, a comment gesture in progress) and comments. A signed field's validation badge (#1895) says its verdict the same way, with any tool, ranked below a comment's description as it was below the comment's tip; the topmost of overlapping badges still speaks. FieldPointer::Over existed only to keep the text layer from overwriting a field's cursor (#2099); the Field layer above Text does that now, so forms_ui::page_input returns whether a field owns the press. Who acts on a press is unchanged (step 3 of the router). The picture's rotate knob claims too: Grab as a handle, Grabbing as a drag while it turns, which dragging_the_rotate_knob_turns_a_page_image now checks. The contains_pointer checks #2755 put before the cursor in content_ui, edit_text_ui, forms_ui and the text layer go: the pages' pointer has no position where the mode bar or a side panel covers a page, so nothing is claimed there, and #2755's tests pass unchanged. During a press the pages hold, those four now keep their cursor over the chrome too, as the other page modules and a text selection being dragged already did. Un-ignores the four step-2 probes in tests/it/pointer.rs, each seen failing on the previous commit at its cursor assertion, after its press assertions passed. A new test, also seen failing there: a link's tip shows only with its hand. Another pins a comment's tip with every tool beside its cursor, and its exceptions; it was seen failing with comment tips tied to the cursor's winner instead, which shows them with the Select tool only. In tests/it/signing.rs, a signed field's badge says its verdict with the Select tool and with a stamp; it fails when the badge is left out of the resolver, as resolving after the page loop would otherwise do. A new ignored probe pins a step-3 bug: over stacked comments the tip names the one drawn on top, but a click selects the one underneath, because PageCx::hit takes the last in inspection's top-edge order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>