From 70700f4c405cdb5e260f177f5e92f16cdd65690b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 18 Nov 2026 16:53:00 -0500 Subject: [PATCH] compile fix 3 (canvas) (swarm/cfix3); committed by the lead --- crates/ui-egui/src/canvas.rs | 37 ++++--- crates/ui-egui/src/canvas/area.rs | 2 +- crates/ui-egui/src/canvas/find.rs | 20 ++-- crates/ui-egui/src/canvas/page_menu.rs | 2 +- crates/ui-egui/src/canvas/page_overlays.rs | 121 +++++++++++++++------ crates/ui-egui/src/canvas/page_tools.rs | 42 ++++--- crates/ui-egui/src/canvas/selection.rs | 1 + 7 files changed, 153 insertions(+), 72 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index eaa5e28177..ce84235604 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -777,7 +777,7 @@ fn finish_sign_requests( if let (Some((page, rect)), QuickTool::SignArea { certify }) = (drawn, tool) { tool = QuickTool::Select; app.quick_tool = tool; - app.start_signing(page, Some(rect), None, certify.then_some(2)); + app.start_signing(ctx, page, Some(rect), None, certify.then_some(2)); } if let Some(field) = app.views[index].session.sign.field.take() { let signed = app.session.get(app.views[index].id).is_some_and(|d| d.signatures.iter().any(|s| s.field == field && s.signed)); @@ -786,7 +786,7 @@ fn finish_sign_requests( crate::side_panels::set_panel_visible(app, RightPanel::Signatures.into(), true); } else { let page = app.views[index].view.current; - app.start_signing(page, None, Some(field), None); + app.start_signing(ctx, page, None, Some(field), None); } } tool @@ -918,9 +918,7 @@ fn page_parts_of( /// The links of the pages: followed under Select, edited under the Link tool. fn links_of<'a>(session: &'a PageSession, cx: &'a PageBodyCx<'_>, body: &'a PageBody<'_>) -> PageLinks<'a> { let mode = if cx.tool == QuickTool::Link { LinkMode::Edit } else { LinkMode::Follow }; - // PLAN: assumed `PageLinks::new(mode, session, info, doc.links(), pages, rotation).text_links(on).tips(on)` - // (pdf-canvas-w15 names `parts` and `read` only). - PageLinks::new(mode, session, cx.info, cx.doc.links(), body.pages, cx.rotation).text_links(cx.text_links).tips(cx.unobstructed) + PageLinks::new(mode, session, cx.info, cx.doc.links(), body.pages, cx.rotation, cx.sizes).text_links(cx.text_links).tips(cx.unobstructed) } /// Whether `phase` is the first pass of a press of `button`. @@ -1101,9 +1099,8 @@ fn page_body(ui: &mut egui::Ui, body: &PageBody<'_>, session: &mut PageSession, }); } if cx.unobstructed && matches!(cx.tool, QuickTool::Select | QuickTool::ColumnSelect) { - // PLAN: assumed `selection_bar(ui, body, session, info, prefs, may_mark, can_copy)`, the old - // `selection_actions` arguments after `body` (pdf-canvas-w12 note 4 gives `(ui, body, view, ..)`). - out.copy_selected = selection::selection_bar(ui, body, session, cx.info, cx.prefs, cx.allowed && !cx.comments_hidden, cx.can_copy); + out.copy_selected = + selection::selection_bar(ui, body, session, cx.info, cx.rotation, cx.prefs, cx.allowed && !cx.comments_hidden, cx.can_copy); } if cx.unobstructed && let Some(page) = cx.info.pages.get(cx.current) @@ -1241,10 +1238,22 @@ pub fn document_area_at(app: &mut PdfCraftApp, index: usize, rect: Rect, ui: &mu } let mut body_out = BodyOut::default(); let date_text = crate::date_text_for_pdf(&app.session); + // The dynamic stamps' lines, filled in for now: the built-in ones write the default line, a custom stamp its own. + let by_line = app.session.stamp_line(crate::stamps_ui::DEFAULT_LINE, &app.comment_prefs.author); + let custom_line = match tool { + QuickTool::CustomStamp(i) => app + .custom_stamps + .get(i) + .and_then(|stamp| stamp.line.as_deref()) + .filter(|line| !line.trim().is_empty()) + .map(|line| app.session.stamp_line(line, &app.comment_prefs.author)), + _ => None, + }; + let custom_stamp = match tool { + QuickTool::CustomStamp(i) => app.custom_stamps.get(i).map(|stamp| (stamp, custom_line.as_deref())), + _ => None, + }; let DocView { view: state, session, momentary, revisions, reports, page_sizes, .. } = &mut *view; - // PLAN: assumed app fields (pdf-hub-w1, pdf-forms-w5): `host_scope: HostScope`, `wake: Wake`, `fill_text_size`, - // `fill_text_color`, `fill_text_border`, `fill_signature`, `fill_initials`, `fill_date_text`, `stamp_by_line`, - // `custom_stamp_choice: Option<(CustomStamp, Option)>`, `animation_effects` and `motion`. let tools = page_tools::PageToolCx { doc, info, @@ -1259,7 +1268,7 @@ pub fn document_area_at(app: &mut PdfCraftApp, index: usize, rect: Rect, ui: &mu presenting, units: app.units, navigation, - host: &app.host_scope, + host: &app.host, wake: &app.wake, author: &app.comment_prefs.author, date_text: &date_text, @@ -1274,8 +1283,8 @@ pub fn document_area_at(app: &mut PdfCraftApp, index: usize, rect: Rect, ui: &mu signature: app.signature.as_ref(), initials: app.initials.as_ref(), }, - by_line: &app.stamp_by_line, - custom_stamp: app.custom_stamp_choice.as_ref().map(|(stamp, line)| (stamp, line.as_deref())), + by_line: &by_line, + custom_stamp, }; let cx = PageBodyCx { doc, diff --git a/crates/ui-egui/src/canvas/area.rs b/crates/ui-egui/src/canvas/area.rs index a8e7946e4a..55dbf9d0a7 100644 --- a/crates/ui-egui/src/canvas/area.rs +++ b/crates/ui-egui/src/canvas/area.rs @@ -260,7 +260,7 @@ pub(super) fn run_button( B::ImportIcon => app.choose_field_image_target(app.views[index].id, name, Some(identity)), B::Script(js) => { let id = app.views[index].id; - app.run_button_script_target(id, name, Some(identity), &js); + app.run_button_script_target(ctx, id, name, Some(identity), &js); } } } diff --git a/crates/ui-egui/src/canvas/find.rs b/crates/ui-egui/src/canvas/find.rs index 051a01d4be..b9301d9393 100644 --- a/crates/ui-egui/src/canvas/find.rs +++ b/crates/ui-egui/src/canvas/find.rs @@ -183,14 +183,18 @@ pub(super) fn find_bar(view: &mut DocView, pages: usize, area: Rect, editing: bo return; } // One id per pane, so two panes' bars do not share a field id (and so the focus). - let shown = TaskBar::at_edge(tl!("Find"), Align::End).id_salt(("find-bar", key)).show(ui, area, |ui, _cx| { - let Find { query, options, matches, bar, replacement, replacing, .. } = &mut *find; - let mut find_bar = FindBar::new(query, options, matches).state(bar).progress(searched, pages); - if editing { - find_bar = find_bar.replace(replacement, replacing); - } - find_bar.show(ui) - }); + let shown = ui + .push_id(("find-bar", key), |ui| { + TaskBar::at_edge(tl!("Find"), Align::End).show(ui, area, |ui, _cx| { + let Find { query, options, matches, bar, replacement, replacing, .. } = &mut *find; + let mut find_bar = FindBar::new(query, options, matches).state(bar).progress(searched, pages); + if editing { + find_bar = find_bar.replace(replacement, replacing); + } + find_bar.show(ui) + }) + }) + .inner; let Some(out) = shown.inner else { return }; if out.closed { view.find = None; diff --git a/crates/ui-egui/src/canvas/page_menu.rs b/crates/ui-egui/src/canvas/page_menu.rs index 36861fac01..f6cdec19dd 100644 --- a/crates/ui-egui/src/canvas/page_menu.rs +++ b/crates/ui-egui/src/canvas/page_menu.rs @@ -270,7 +270,7 @@ fn field_rows( Divider::horizontal().show(ui); let delete = if view.session.prepare.also.is_empty() { "Delete" } else { "Delete selected fields" }; if MenuItem::new(tl!(delete).to_string()).enabled(can_modify).show(ui).ran { - view.session.pending_edit = crate::prepare::delete_selected(view); + view.session.pending_edit = crate::prepare::delete_selected(&mut view.session); } } diff --git a/crates/ui-egui/src/canvas/page_overlays.rs b/crates/ui-egui/src/canvas/page_overlays.rs index a7f22a0244..d894e7c571 100644 --- a/crates/ui-egui/src/canvas/page_overlays.rs +++ b/crates/ui-egui/src/canvas/page_overlays.rs @@ -9,19 +9,19 @@ // `content_controls`, `forms_ui::paint_page`, ..) are shown by w8's page body before `PageOverlays`, because each is // its own component and their signatures are their owners'. -use craft::behavior::{HitShape, IconId, Input, PointerButton, PressPhase, Sense}; +use craft::behavior::{CursorIcon, HitShape, IconId, Input, PointerButton, PressPhase, Sense}; +use craft::pages::ui::PlacedPage; use craft::theme::variant::Tone; use craft::ui::contract::{Access, Animate as _, Common, Component, Cx, MeasureCx, NoValue, Outcome, PaintUi, Props, Role, Show as _}; use craft::ui::primitives::{Draw, IconSpec, PaintShape, StrokeWidth, TextRun}; use craft::ui::style::{ComponentStyle, DataColor, Metrics, StyleColor, StyleCx, TypeRole}; -use egui::{Color32, CornerRadius, CursorIcon, Rect, Response, Vec2, pos2}; +use egui::{Color32, CornerRadius, Rect, Response, Vec2, pos2}; use pdfcraft_engine::{Document, FormFieldKind, LinkItem}; use pdfcraft_render::{DocInfo, Link, LinkTarget}; use super::area::{MARK_ICON_SHARE, SignTab, mark_anchor, sign_tab_on_page, sign_tabs, signature_badges, verdict_mark_rect}; use super::page_parts::{Owner, PageLayer, PagePart, PagePress}; -use super::{DocView, PageXform}; -use crate::QuickTool; +use super::{DocView, PageSession, PageXform}; use crate::link_ui::{LINK_TOOL_MARGIN, target_label}; use crate::sign_ui::status_tone; @@ -74,32 +74,93 @@ pub(crate) enum LinkEvent { /// as page text. One list builds the parts and the same list reads their presses, so what the hand promises /// is what the click does. pub(crate) struct PageLinks<'a> { - /// What a click on a link does. - pub mode: LinkMode, - /// The view, whose text layer the written addresses come from. The caller refreshes them + mode: LinkMode, + /// The session, whose text layer the written addresses come from. The caller refreshes them /// (`DocView::refresh_text_links`) before the parts are built. - pub view: &'a DocView, - /// The document's page and link listing. - pub info: &'a DocInfo, - /// The page's place on screen. - pub xf: &'a PageXform, - /// The page. - pub page: usize, - /// The tool: only Select follows links and only Link edits them. - pub tool: QuickTool, - /// Whether addresses written as page text open too (Preferences). - pub text_links: bool, - /// Nothing is drawn over the pages (no palette, no menu), so tips show and a click counts. - pub unobstructed: bool, + session: &'a PageSession, + info: &'a DocInfo, /// In `Edit`, every link the document has (the engine's listing, which holds links the renderer cannot /// follow too); empty in `Follow`. - pub engine: &'a [LinkItem], + engine: &'a [LinkItem], + pages: &'a [PlacedPage], + rotation: u16, + sizes: &'a [(f32, f32)], + text_links: bool, + unobstructed: bool, } -impl PageLinks<'_> { - /// Appends the page's link parts, later links over earlier ones as the renderer draws them. Links are +/// One page's link family: what [`PageLinks`] builds the parts and reads the presses of a page with. +struct LinksOnPage<'a> { + mode: LinkMode, + session: &'a PageSession, + info: &'a DocInfo, + engine: &'a [LinkItem], + text_links: bool, + unobstructed: bool, + /// The page's place on screen. + xf: PageXform, + page: usize, +} + +impl<'a> PageLinks<'a> { + /// The links of `pages`, placed as `rotation` turns the view and `sizes` gives each page's size in view space. + /// `Follow` is the Select tool's mode, `Edit` the Link tool's; addresses written as page text are off and tips + /// are off until [`text_links`](Self::text_links) and [`tips`](Self::tips) say otherwise. + pub(crate) fn new( + mode: LinkMode, + session: &'a PageSession, + info: &'a DocInfo, + engine: &'a [LinkItem], + pages: &'a [PlacedPage], + rotation: u16, + sizes: &'a [(f32, f32)], + ) -> Self { + Self { mode, session, info, engine, pages, rotation, sizes, text_links: false, unobstructed: false } + } + + /// Whether addresses written as page text open too (Preferences). + pub(crate) fn text_links(mut self, on: bool) -> Self { + self.text_links = on; + self + } + + /// Nothing is drawn over the pages (no palette, no menu), so tips show and a click counts. + pub(crate) fn tips(mut self, on: bool) -> Self { + self.unobstructed = on; + self + } + + fn on_page(&self, placed: &PlacedPage) -> LinksOnPage<'a> { + let size = self.sizes.get(placed.page).copied().unwrap_or_default(); + LinksOnPage { + mode: self.mode, + session: self.session, + info: self.info, + engine: self.engine, + text_links: self.text_links, + unobstructed: self.unobstructed, + xf: PageXform::of(placed, self.rotation, size), + page: placed.page, + } + } + + /// Appends the pages' link parts, later links over earlier ones as the renderer draws them. Links are /// click-only parts: a drag over one reaches what lies under it (a text selection, a new link). pub(crate) fn parts(&self, out: &mut Vec) { + for placed in self.pages { + self.on_page(placed).parts(out); + } + } + + /// What `press` did to a link of its page, or `None` when it is no click of the pages' links. + pub(crate) fn read(&self, press: &PagePress) -> Option { + let placed = self.pages.iter().find(|placed| placed.page == press.page)?; + self.on_page(placed).read(press) + } +} + +impl LinksOnPage<'_> { + fn parts(&self, out: &mut Vec) { match self.mode { LinkMode::Follow => self.follow_parts(out), LinkMode::Edit => self.edit_parts(out), @@ -107,9 +168,6 @@ impl PageLinks<'_> { } fn follow_parts(&self, out: &mut Vec) { - if !matches!(self.tool, QuickTool::Select | QuickTool::Link) { - return; - } for link in self.info.links.iter().filter(|l| l.page == self.page) { let tip = self.unobstructed.then(|| target_label(self.info, &link.target)); for shape in self.link_shapes(link) { @@ -119,7 +177,7 @@ impl PageLinks<'_> { if !self.text_links { return; } - let (Some((_, found)), Some(page_info)) = (self.view.session.text_links.get(&self.page), self.info.pages.get(self.page)) else { return }; + let (Some((_, found)), Some(page_info)) = (self.session.text_links.get(&self.page), self.info.pages.get(self.page)) else { return }; for (index, link) in found.iter().enumerate() { // The annotation over an address is what the document asks for there. if self.info.links.iter().any(|l| l.page == self.page && link.covered_by(page_info, l.rect)) { @@ -184,7 +242,7 @@ impl PageLinks<'_> { /// What `press` did to a link of this family, or `None` when it is no click of this page's links. /// A press that was not released over the part it began on is no click (`PressPhase::Release`). It /// reads only the press it is given, so a pass that reports none follows nothing. - pub(crate) fn read(&self, press: &PagePress) -> Option { + fn read(&self, press: &PagePress) -> Option { let PressPhase::Release { start, click: true, .. } = &press.phase else { return None }; if press.page != self.page { return None; @@ -199,7 +257,8 @@ impl PageLinks<'_> { // A web or email address written as page text (#4207): the same click, the same check and // confirmation on opening. (LinkMode::Follow, Owner::TextLink { index }) if primary && self.follows() => { - let uri = self.view.text_link_uri(self.page, index)?; + let (_, found) = self.session.text_links.get(&self.page)?; + let uri = found.get(index)?.uri.clone(); Some(LinkEvent::Follow { target: LinkTarget::Uri(uri), javascript: None }) } (LinkMode::Edit, Owner::Link { index }) if primary => Some(LinkEvent::Select { page: self.page, index, clicks: start.clicks }), @@ -210,9 +269,9 @@ impl PageLinks<'_> { } } - /// Whether a click follows a link: with the Select tool, with nothing drawn over the pages. + /// Whether a click follows a link: `Follow` is the Select tool's mode, and nothing is drawn over the pages. fn follows(&self) -> bool { - self.unobstructed && self.tool == QuickTool::Select + self.unobstructed && self.mode == LinkMode::Follow } } diff --git a/crates/ui-egui/src/canvas/page_tools.rs b/crates/ui-egui/src/canvas/page_tools.rs index 17d95c23a0..6f923ec4f4 100644 --- a/crates/ui-egui/src/canvas/page_tools.rs +++ b/crates/ui-egui/src/canvas/page_tools.rs @@ -4,20 +4,21 @@ //! ([`PageTool::finish`]) and applied to the session ([`ToolFinish::apply`]). use craft::behavior::{CancelReason, Cursor, PointerButton}; -use craft::host::{HostScope, Wake}; +use craft::host::{Host, Wake}; use craft::keymap::Mods; -use craft::pages::ui::{PageTexts, PlacedPage, TextSelectState}; +use craft::pages::ui::{PageTextSource as _, PageTexts, PlacedPage, TextSelectState}; use craft::review::SavedSignature; use craft::ui::canvas::{ CanvasTool, HandTool, NavigationOptions, ToolAccess, ToolAction, ToolClaims, ToolContext, ToolKey, ToolPath, ToolPointer, ToolRegion, ZoomTool, }; use craft::ui::primitives::Draw; +use egui::Pos2; use pdfcraft_engine::{Document, Edit, FormField}; use pdfcraft_render::DocInfo; use super::crop::{CropResult, CropTool}; use super::page_parts::{Owner, PagePress}; -use super::page_select::PageSelectTool; +use super::page_select::{PageSelectTool, PickSlots}; use super::selection::DocTexts; use super::zoom_snap::SnapshotTool; use super::{PageSession, PageXform, presenter}; @@ -86,7 +87,7 @@ pub(crate) struct PageToolCx<'a> { /// The user's navigation choices, which the Hand and Zoom tools read. pub(crate) navigation: NavigationOptions, /// The app's Host, which the tools that run background jobs build their queues from (L-135). - pub(crate) host: &'a HostScope, + pub(crate) host: &'a Host, /// The app's one wake source (L-168), for those queues. // PLAN: pdf-canvas-w8 passes `&app.wake` (hub-w1's field); its `PageToolCx` literal has no `wake`. pub(crate) wake: &'a Wake, @@ -108,6 +109,7 @@ pub(crate) struct PageToolCx<'a> { pub(crate) struct ToolBench<'a> { texts: Option>, xforms: Vec<(usize, PageXform)>, + map: Option>, } /// The tool a pass runs: the Select tool's text selection, a view tool, or a tool a page module writes. @@ -221,7 +223,7 @@ fn select_tool<'a>( picked_image: &'a mut Option, xforms: &'a [(usize, PageXform)], ) -> PageSelectTool<'a> { - PageSelectTool::new(cx.pages, texts, text, cx.info, pending_pick, picked_image, xforms, cx.doc.edit_generation()) + PageSelectTool::new(cx.pages, texts, text, cx.info, PickSlots::new(pending_pick, picked_image), xforms, cx.doc.edit_generation()) } /// The page tool for `chosen` this pass. The placing rule applies first ([`seen_tool`]); Fill & Sign leaves its @@ -237,32 +239,37 @@ pub(crate) fn page_tool<'a>( fill: &'a mut Option, ) -> PageTool<'a> { let tool = seen_tool(session, chosen); - let ToolBench { texts: texts_slot, xforms } = bench; + let ToolBench { texts: texts_slot, xforms, map: map_slot } = bench; let sizes = cx.sizes; let size = move |page: usize| sizes.get(page).copied().unwrap_or_default(); *xforms = cx.pages.iter().map(|placed| (placed.page, PageXform::of(placed, cx.rotation, size(placed.page)))).collect(); let xforms: &'a [(usize, PageXform)] = xforms; + let map: &'a comments::PageMap<'a> = map_slot.insert(comments::PageMap::new(cx.info, cx.pages, cx.rotation)); let selects_text = tool_selects_text(tool, cx.preparing); let arm = match tool { // Prepare a form under the Select tool: the selection rectangle and the moves of fields are Prepare's. - QuickTool::Select if cx.preparing => Arm::Area(Box::new(PrepareTool::new(None, cx.can_modify, cx.form, session))), + QuickTool::Select if cx.preparing => Arm::Area(Box::new(PrepareTool::new(None, cx.can_modify, cx.form, session, cx.info, xforms))), QuickTool::Select | QuickTool::ColumnSelect | QuickTool::Comment(_) | QuickTool::Redact => { let texts: &'a DocTexts<'a> = texts_slot.insert(DocTexts::new(&session.texts, &session.text_failed, cx.rotation, cx.sizes)); let select = select_tool(&cx, &mut session.text, texts, &mut session.pending_pick, &mut session.picked_image, xforms); match tool { QuickTool::ColumnSelect => Arm::Select(select.column(true)), QuickTool::Redact => { - // PLAN: assumed `RedactTool::new(select, pages, rotation, info, allowed)` (forms-w13 gives no list). - Arm::Redact(RedactTool::new(select, cx.pages, cx.rotation, cx.info, cx.can_modify)) + let pages = cx.pages; + let over_text = move |at: Pos2| { + pages + .iter() + .find(|placed| placed.rect.contains(at)) + .is_some_and(|placed| texts.app(placed.page).is_some_and(|layer| layer.glyph_box_at(placed.to_page(at)).is_some())) + }; + Arm::Redact(RedactTool::new(select, cx.pages, cx.rotation, cx.info, over_text)) } // Select runs the comments tool too: a hanging paste is placed by its press, and a press no comment // part took goes on to the text. - // PLAN: assumed `CommentsTool::new(&mut AnnotateTool, Option<&mut PastePlacement>, PageMap, &mut bool)` - // and `.text(PageSelectTool)` (comments-w8 names the fields, not the constructor). _ => { let view = &mut session.comments; let map = comments::PageMap::new(cx.info, cx.pages, cx.rotation); - let annotate = CommentsTool::new(&mut view.tool, view.paste.as_mut(), map, &mut view.tool_done); + let annotate = CommentsTool::new(&mut view.tool, &mut view.paste, map, &mut view.tool_done); let annotate = if selects_text { annotate.text(select) } else { annotate }; Arm::Area(Box::new(annotate)) } @@ -275,7 +282,7 @@ pub(crate) fn page_tool<'a>( Arm::MarqueeZoom(ZoomTool::new(options)) } QuickTool::Measure(t) => { - Arm::Measure(MeasureTool::new(&mut session.measure, cx.doc, cx.pages, cx.info, t, cx.units, cx.host, cx.wake.clone())) + Arm::Measure(MeasureTool::new(&mut session.measure, cx.doc, map, cx.info, t, cx.units, cx.author, cx.host, cx.wake.clone())) } QuickTool::Crop => Arm::Crop(CropTool::new(cx.can_crop, cx.pages, cx.rotation, size)), QuickTool::EnhanceCamera => Arm::Camera(CameraTool::new(cx.can_modify, cx.pages)), @@ -294,13 +301,13 @@ pub(crate) fn page_tool<'a>( }; Arm::Area(Box::new(FillSignTool::new(&cx, input, fill))) } - QuickTool::Field(field_tool) => Arm::Area(Box::new(PrepareTool::new(Some(field_tool), cx.can_modify, cx.form, session))), + QuickTool::Field(field_tool) => Arm::Area(Box::new(PrepareTool::new(Some(field_tool), cx.can_modify, cx.form, session, cx.info, xforms))), // PLAN: assumed `AddTextTool::new(session, doc, info)` in `content_ui` (pdf-edit-w7 gives no argument list). QuickTool::AddText => Arm::Area(Box::new(crate::tools::content_ui::AddTextTool::new(session, cx.doc, cx.info))), // PLAN: pdf-edit-w10's `EditTextTool::new(view, doc, info)` takes no placed pages, which the review asked to hand over. QuickTool::EditText => Arm::Area(Box::new(EditTextTool::new(session, cx.doc, cx.info))), QuickTool::Stamp(kind) => { - Arm::Stamp(StampTool::new(StampChoice::Builtin(kind), cx.by_line.to_owned(), None, cx.author.to_owned(), cx.pages, cx.info)) + Arm::Stamp(StampTool::new(StampChoice::Builtin(kind), cx.by_line.to_owned(), None, cx.author.to_owned(), cx.pages, cx.info, map)) } QuickTool::CustomStamp(_) => match cx.custom_stamp { Some((stamp, line)) => Arm::Stamp(StampTool::new( @@ -310,13 +317,14 @@ pub(crate) fn page_tool<'a>( cx.author.to_owned(), cx.pages, cx.info, + map, )), // The library no longer holds the stamp: no click places one, and a drag pans as the Hand tool's. None => Arm::Hand(HandTool::new(cx.navigation)), }, // PLAN: assumed `LinkTool::new(session, doc, info, can_modify)` (pdf-edit-w11 gives `new(view, ..)`). QuickTool::Link => Arm::Area(Box::new(LinkTool::new(session, cx.doc, cx.info, cx.can_modify))), - QuickTool::SignArea { certify } => Arm::SignArea(SignAreaTool::new(certify, cx.pages, cx.info)), + QuickTool::SignArea { certify } => Arm::SignArea(SignAreaTool::new(certify, cx.pages, cx.rotation, cx.info)), QuickTool::Snapshot => Arm::Snapshot(SnapshotTool::new(cx.pages, cx.rotation, size)), }; PageTool { arm, tool, selects_text, released: false, presenting: cx.presenting, presenter_keys: Vec::new() } @@ -370,7 +378,7 @@ impl<'a> PageTool<'a> { Arm::Camera(tool) => finish.camera_page = tool.moved_to(), Arm::Measure(mut tool) => finish.edit = tool.take_edit(), Arm::Stamp(mut tool) => { - finish.edit = tool.take_placed(); + finish.edit = tool.placed(); finish.back_to_select = finish.edit.is_some(); } Arm::Redact(mut tool) => finish.redaction = tool.finished(), diff --git a/crates/ui-egui/src/canvas/selection.rs b/crates/ui-egui/src/canvas/selection.rs index 70ce851f4f..3a0496e093 100644 --- a/crates/ui-egui/src/canvas/selection.rs +++ b/crates/ui-egui/src/canvas/selection.rs @@ -1,5 +1,6 @@ use super::{Arc, DocInfo, DocView, Edit, PageSession, PageText, Pos2, Range, Rect, comments}; use crate::QuickTool; +use craft::behavior::Selection; use craft::behavior::kurbo::{self, Point}; use craft::pages::ui::{PageBody, PageTextSource, PageTexts, TextSelection, TextSpan as FwSpan}; use craft::ui::buttons::Button;