PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
M7: move and resize existing text boxes in Edit text (#40)
Brandon Thomas93221c688651
diff --git a/crates/automation/src/lib.rs b/crates/automation/src/lib.rsindex 99c14b947..112a88317 100644--- a/crates/automation/src/lib.rs+++ b/crates/automation/src/lib.rs@@ -398,8 +398,13 @@ impl Automation {line_spacing: a.opt_num("line_spacing")?,char_spacing: a.opt_num("char_spacing")?,scale: a.opt_num("scale")?,+ width: a.opt_num("width")?,..Default::default()};+ let (dx, dy) = (a.opt_num("dx")?, a.opt_num("dy")?);+ if dx.is_some() || dy.is_some() {+ style.offset = Some([dx.unwrap_or(0.0), dy.unwrap_or(0.0)]);+ }if let Some(f) = a.opt_str("font")? {let family = match f {"helvetica" => printcraft_engine::FontFamily::Helvetica,diff --git a/crates/automation/src/tools.rs b/crates/automation/src/tools.rsindex a8eba2d21..a465b8f26 100644--- a/crates/automation/src/tools.rs+++ b/crates/automation/src/tools.rs@@ -949,7 +949,7 @@ pub fn tools() -> Vec<ToolDef> {.ro().cmd("edit.edit_text").with(schema(json!({ "doc": doc(), "page": { "type": "integer", "minimum": 1 } }), &["doc", "page"])),- t("text_edit", "Edit text", "Replace the text of one paragraph (paragraph, from text_paragraphs: rewrapped to the paragraph's width with its line spacing) or one line (line, from text_lines) in place, keeping position, size and colour. For a paragraph, also change its formatting: font (helvetica, times, courier) with bold/italic, size (points), color (#rrggbb), align (left, center, right, justify), underline, line_spacing (× size), char_spacing (points) and scale (horizontal, percent); text may then be omitted. Its own font is reused when it can show every character; otherwise the line is set in Helvetica (the result shows the font used). Text that no available font can show is refused. Undoable.")+ t("text_edit", "Edit text", "Replace the text of one paragraph (paragraph, from text_paragraphs: rewrapped to the paragraph's width with its line spacing) or one line (line, from text_lines) in place, keeping position, size and colour. For a paragraph, also change its formatting: font (helvetica, times, courier) with bold/italic, size (points), color (#rrggbb), align (left, center, right, justify), underline, line_spacing (× size), char_spacing (points) and scale (horizontal, percent), or move it (dx, dy in points; up is +dy) and rewrap it to a new width (points); text may then be omitted. Its own font is reused when it can show every character; otherwise the line is set in Helvetica (the result shows the font used). Text that no available font can show is refused. Undoable.").cmd("edit.edit_text").with(schema(json!({ "doc": doc(), "page": { "type": "integer", "minimum": 1 }, "line": { "type": "integer", "minimum": 1 },@@ -963,6 +963,9 @@ pub fn tools() -> Vec<ToolDef> {"align": { "type": "string", "enum": ["left", "center", "right", "justify"] },"underline": { "type": "boolean" },"line_spacing": { "type": "number", "description": "Multiple of the font size (1.2 is ordinary)." },+ "dx": { "type": "number", "description": "Paragraph only: move right by this many points (negative: left)." },+ "dy": { "type": "number", "description": "Paragraph only: move up by this many points (negative: down)." },+ "width": { "type": "number", "description": "Paragraph only: rewrap to this width in points (dragging the box's edge)." },"char_spacing": { "type": "number", "description": "Points." },"scale": { "type": "number", "description": "Horizontal scale in percent." } }),&["doc", "page"],diff --git a/crates/automation/tests/automation.rs b/crates/automation/tests/automation.rsindex 035eaf16a..97c6821d4 100644--- a/crates/automation/tests/automation.rs+++ b/crates/automation/tests/automation.rs@@ -671,6 +671,18 @@ fn editing_existing_text_through_tools() {);let p = &ok(&mut a, "text_paragraphs", json!({ "doc": doc, "page": 3 }))["paragraphs"][0];assert_eq!((p["text"].as_str(), p["font"].as_str(), p["size"].as_f64()), (Some("Part three"), Some("Times-Bold"), Some(20.0)));+ // Moved 15 pt right and 10 pt down (dy is up; the listing's rect is measured from the top).+ let rect = |p: &serde_json::Value| -> Vec<f64> { p["rect"].as_array().unwrap().iter().map(|v| v.as_f64().unwrap()).collect() };+ let before = rect(p);+ ok(&mut a, "text_edit", json!({ "doc": doc, "page": 3, "paragraph": 1, "dx": 15, "dy": -10 }));+ let p = ok(&mut a, "text_paragraphs", json!({ "doc": doc, "page": 3 }))["paragraphs"][0].clone();+ let after = rect(&p);+ assert!((after[0] - before[0] - 15.0).abs() < 0.5 && (after[1] - before[1] - 10.0).abs() < 0.5, "{before:?} → {after:?}");+ assert_eq!(p["text"], "Part three");+ // A narrow width rewraps "Part three" onto two lines.+ ok(&mut a, "text_edit", json!({ "doc": doc, "page": 3, "paragraph": 1, "width": 50 }));+ let p = &ok(&mut a, "text_paragraphs", json!({ "doc": doc, "page": 3 }))["paragraphs"][0];+ assert_eq!(p["lines"].as_array().map(Vec::len), Some(2), "{p}");}#[test]diff --git a/crates/edit/src/tests.rs b/crates/edit/src/tests.rsindex 709cd9ce1..df324a8f6 100644--- a/crates/edit/src/tests.rs+++ b/crates/edit/src/tests.rs@@ -649,3 +649,45 @@ fn a_line_drawn_twice_is_replaced_everywhere() {let lines = text::text_lines(&doc, 0).unwrap();assert_eq!(lines.iter().map(|l| l.text.as_str()).collect::<Vec<_>>(), ["Hello there", "world"]);}++#[test]+fn paragraphs_move_and_rewrap_to_a_new_width() {+ let para = "BT /F1 10 Tf 12 TL 100 700 Td (One two three four five six seven) Tj T* (eight nine ten eleven twelve) Tj ET";+ let close = |a: f64, b: f64| (a - b).abs() < 0.5;+ // Moved 50 right and 200 down, same words and wrapping.+ let mut doc = text_page(para);+ let before = text::text_blocks(&doc, 0).unwrap()[0].clone();+ text::rewrite_block(&mut doc, 0, 0, None, &text::BlockStyle { offset: Some([50.0, -200.0]), ..Default::default() }).unwrap();+ let doc = reopen(&doc);+ let after = text::text_blocks(&doc, 0).unwrap()[0].clone();+ assert_eq!((after.text.as_str(), after.lines.len()), (before.text.as_str(), before.lines.len()));+ assert!(close(after.rect[0], before.rect[0] + 50.0) && close(after.rect[1], before.rect[1] - 200.0), "{:?} → {:?}", before.rect, after.rect);+ // Drawn at half scale: the move is still in page space.+ let mut doc = text_page(&format!("q 0.5 0 0 0.5 0 0 cm {} Q", para.replace("100 700 Td", "200 1400 Td")));+ let before = text::text_blocks(&doc, 0).unwrap()[0].clone();+ text::rewrite_block(&mut doc, 0, 0, None, &text::BlockStyle { offset: Some([30.0, 40.0]), ..Default::default() }).unwrap();+ let after = text::text_blocks(&reopen(&doc), 0).unwrap()[0].clone();+ assert!(close(after.rect[0], before.rect[0] + 30.0) && close(after.rect[1], before.rect[1] + 40.0), "{:?} → {:?}", before.rect, after.rect);+ // A narrower box rewraps into more lines that fit it; a wider one into fewer.+ let mut doc = text_page(para);+ let left = text::text_blocks(&doc, 0).unwrap()[0].rect[0];+ text::rewrite_block(&mut doc, 0, 0, None, &text::BlockStyle { width: Some(80.0), ..Default::default() }).unwrap();+ let narrow = text::text_blocks(&reopen(&doc), 0).unwrap()[0].clone();+ assert!(narrow.lines.len() > 2, "{narrow:?}");+ assert!(narrow.rect[2] <= left + 80.5, "{narrow:?}");+ let mut doc = text_page(para);+ text::rewrite_block(&mut doc, 0, 0, None, &text::BlockStyle { width: Some(400.0), ..Default::default() }).unwrap();+ assert_eq!(text::text_blocks(&reopen(&doc), 0).unwrap()[0].lines.len(), 1);+ // Untrusted numbers (the automation tools pass them through) are refused, not drawn.+ let mut doc = text_page(para);+ for style in [+ text::BlockStyle { offset: Some([f64::NAN, 0.0]), ..Default::default() },+ text::BlockStyle { offset: Some([0.0, f64::INFINITY]), ..Default::default() },+ text::BlockStyle { width: Some(f64::NAN), ..Default::default() },+ ] {+ assert!(text::rewrite_block(&mut doc, 0, 0, None, &style).is_err(), "{style:?}");+ }+ // A zero width is clamped to one character's width rather than looping or vanishing.+ text::rewrite_block(&mut doc, 0, 0, None, &text::BlockStyle { width: Some(0.0), ..Default::default() }).unwrap();+ assert_eq!(text::text_blocks(&reopen(&doc), 0).unwrap().iter().map(|b| b.text.split_whitespace().count()).sum::<usize>(), 12);+}diff --git a/crates/edit/src/text.rs b/crates/edit/src/text.rsindex fad0841db..e821384fd 100644--- a/crates/edit/src/text.rs+++ b/crates/edit/src/text.rs@@ -93,6 +93,8 @@ struct Origin {tlm: [f64; 6],/// Text-space units → user space (the scale of the text rendering matrix's y axis).k: f64,+ /// The CTM there (current space → page space), for moving the paragraph in page space.+ ctm: [f64; 6],baseline: f64,x: f64,state: TextState,@@ -430,6 +432,7 @@ pub fn text_lines(doc: &Document, page: usize) -> Result<Vec<TextLine>, EditErrotm: s.tm.0,tlm: s.tlm.0,k: (s.tm.then(&s.state.ctm).0[2].powi(2) + s.tm.then(&s.state.ctm).0[3].powi(2)).sqrt(),+ ctm: s.state.ctm.0,baseline: s.baseline,x: s.start_x,state: TextState::of(&s.state),@@ -806,6 +809,10 @@ pub struct BlockStyle {/// Character spacing (points) and horizontal scaling (percent).pub char_spacing: Option<f64>,pub scale: Option<f64>,+ /// Move the paragraph by `[dx, dy]` in user space (dragging its box).+ pub offset: Option<[f64; 2]>,+ /// Rewrap to this width in user space (dragging the box's edge).+ pub width: Option<f64>,}/// Rewrite paragraph `block` with new text (or its own) and formatting, rewrapped to its width.@@ -848,12 +855,19 @@ pub fn rewrite_block(doc: &mut Document, page: usize, block: usize, text: Optioncrate::added::Family::Helvetica => printcraft_fonts::helvetica_width(s, size) * if bold { 1.05 } else { 1.0 },}};- // A paragraph keeps its width; a single line grows to the right, up to the page's margin.- let mut width = (b.rect[2] - b.rect[0]).max(size * k);- if members.len() == 1 {- let crop = p.crop(doc);- width = width.max(crop[2] - 36.0 - b.rect[0]);+ let [dx, dy] = style.offset.unwrap_or([0.0, 0.0]);+ if !(dx.is_finite() && dy.is_finite()) {+ return Err(EditError::Invalid("the paragraph can't be moved that far".into()));}+ // A paragraph keeps its width (or takes the one asked for); a single line grows to the right,+ // up to the page's margin.+ let width = match style.width {+ // Capped at the largest page PDF allows (14 400 pt).+ Some(w) if w.is_finite() => w.clamp(size * k, 14_400.0),+ Some(_) => return Err(EditError::Invalid("the paragraph's width must be a number".into())),+ None if members.len() == 1 => (b.rect[2] - b.rect[0]).max(size * k).max(p.crop(doc)[2] - 36.0 - (b.rect[0] + dx)),+ None => (b.rect[2] - b.rect[0]).max(size * k),+ };let advance = |s: &str| -> f64 {let t = match (&metrics, reuse) {(Some(m), true) => m@@ -911,7 +925,18 @@ pub fn rewrite_block(doc: &mut Document, page: usize, block: usize, text: Option};let n = printcraft_content::num;// In its own graphics state, so a new colour (or anything else) stops at the paragraph.- let mut block_ops = vec![Op::new("q", vec![]), Op::new("BT", vec![])];+ let mut block_ops = vec![Op::new("q", vec![])];+ // Moved: a translation inside that state. The move is in page space, so it is taken back+ // through the CTM's linear part into the space the paragraph is drawn in.+ if dx != 0.0 || dy != 0.0 {+ let c = o.ctm;+ let back = Matrix([c[0], c[1], c[2], c[3], 0.0, 0.0])+ .invert()+ .ok_or_else(|| EditError::Invalid("the paragraph is drawn in a space it can't be moved in".into()))?;+ let (ax, ay) = back.apply(dx, dy);+ block_ops.push(Op::new("cm", vec![n(1.0), n(0.0), n(0.0), n(1.0), n(ax), n(ay)]));+ }+ block_ops.push(Op::new("BT", vec![]));let mut state = o_state.clone();state.word_spacing = 0.0;state.font = Some((show_font, size));diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex 2ab31ec71..048f2e6e7 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -146,6 +146,8 @@ pub struct DocView {/// Edit text & images: the images per page (by document generation), and the selected one.pub(crate) edit_images: HashMap<usize, (u64, Vec<printcraft_engine::PageImage>)>,pub image_selection: Option<crate::edit_text_ui::ImageSelection>,+ /// A paragraph box being dragged (moved, or resized from its right edge) in Edit text.+ pub block_drag: Option<crate::edit_text_ui::BlockDrag>,/// Commenting state: selected comment, gestures, composer.pub comments: crate::comments::CommentView,/// Form filling state: the focused field.@@ -250,6 +252,7 @@ impl DocView {line_editor: None,edit_images: HashMap::new(),image_selection: None,+ block_drag: None,pending_action: None,comments: Default::default(),forms: Default::default(),diff --git a/crates/ui-egui/src/edit_text_ui.rs b/crates/ui-egui/src/edit_text_ui.rsindex cc9498be7..4805b43c8 100644--- a/crates/ui-egui/src/edit_text_ui.rs+++ b/crates/ui-egui/src/edit_text_ui.rs@@ -1,6 +1,7 @@//! Edit a PDF ▸ Edit text & images: boxes around the paragraphs and images already on the page.//! Click a paragraph to edit it in place (⌘Enter or clicking away applies and rewraps it to the-//! box, Esc cancels). Click an image to select it: drag to move, drag a corner to resize (keeping+//! box, Esc cancels); drag it to move it, or drag the handle on its right edge to rewrap it to a+//! new width. Click an image to select it: drag to move, drag a corner to resize (keeping//! its proportions), right-click for rotate, flip, replace, save and delete; Delete removes it.use egui::{Color32, CornerRadius, FontFamily, FontId, Pos2, Rect, Stroke};@@ -98,6 +99,7 @@ impl LineEditor {.then_some(self.extras.line_spacing),char_spacing: (self.extras.char_spacing != self.extras0.char_spacing).then_some(self.extras.char_spacing),scale: (self.extras.scale != self.extras0.scale).then_some(self.extras.scale),+ ..Default::default()}}@@ -167,6 +169,21 @@ pub struct ImageSelection {drag: Option<(Pos2, Option<Pos2>)>,}+/// A paragraph box being dragged: moved, or (from the handle on its right edge) resized.+#[derive(Clone, Copy, Debug, PartialEq)]+pub struct BlockDrag {+ page: usize,+ block: usize,+ /// Where the drag started (screen).+ start: Pos2,+ resize: bool,+}++/// The resize handle on a paragraph box's right edge (screen).+fn width_handle(b: Rect) -> Rect {+ Rect::from_center_size(Pos2::new(b.right(), b.center().y), egui::vec2(7.0, 14.0))+}+/// What a right-click on a selected image asks for.#[derive(Clone, Copy, Debug, PartialEq)]pub(crate) enum ImageAction {@@ -339,12 +356,57 @@ pub(crate) fn page_input(painter.rect_stroke(*b, CornerRadius::same(2), Stroke::new(0.75, ACCENT.gamma_multiply(0.35)), egui::StrokeKind::Outside);}}+ // The width handle needs the page upright (or upside down): on a quarter-turned page the+ // screen's horizontal is the paragraph's vertical.+ let upright = info.pages.get(page).is_some_and(|p| p.rotation % 180 == 0);+ // A drag in progress: the box follows the pointer (or its right edge does); releasing applies it.+ if let Some(d) = view.block_drag.filter(|d| d.page == page)+ && let (Some(b), Some(l)) = (boxes.get(d.block).copied(), lines.get(d.block))+ {+ let p = ui.input(|i| i.pointer.interact_pos()).unwrap_or(d.start);+ let preview = if d.resize {+ Rect::from_min_max(b.min, Pos2::new((b.right() + p.x - d.start.x).max(b.left() + 12.0), b.max.y))+ } else {+ b.translate(p - d.start)+ };+ painter.rect_stroke(preview, CornerRadius::same(2), Stroke::new(1.5, ACCENT), egui::StrokeKind::Outside);+ ui.ctx().set_cursor_icon(if d.resize { egui::CursorIcon::ResizeHorizontal } else { egui::CursorIcon::Grabbing });+ if resp.drag_stopped() || !ui.input(|i| i.pointer.any_down()) {+ view.block_drag = None;+ let (from, to) = (user_box(xf, info, page, b), user_box(xf, info, page, preview));+ let style = if d.resize {+ // The new width in user space: the box's change, added to the paragraph's own.+ let width = (l.rect[2] - l.rect[0]) + (to[2] - to[0]) - (from[2] - from[0]);+ printcraft_engine::BlockStyle { width: Some(width), ..Default::default() }+ } else {+ printcraft_engine::BlockStyle { offset: Some([to[0] - from[0], to[1] - from[1]]), ..Default::default() }+ };+ if preview != b {+ view.pending_edit = Some(Edit::EditTextBlock { page, block: d.block, text: l.text.clone(), style });+ }+ }+ return true;+ }let Some(p) = ui.input(|i| i.pointer.hover_pos()).filter(|p| xf.rect.contains(*p)) else { return false };- let Some(hit) = boxes.iter().rposition(|b| b.contains(p)) else { return false };+ let Some(hit) = boxes.iter().rposition(|b| b.contains(p) || (upright && width_handle(*b).contains(p))) else { return false };if active != Some(hit) {painter.rect_stroke(boxes[hit], CornerRadius::same(2), Stroke::new(1.5, ACCENT), egui::StrokeKind::Outside);}- ui.ctx().set_cursor_icon(egui::CursorIcon::Text);+ let on_handle = upright && active.is_none() && width_handle(boxes[hit]).contains(p);+ if upright && active.is_none() {+ painter.rect(width_handle(boxes[hit]), CornerRadius::same(2), Color32::WHITE, Stroke::new(1.0, ACCENT), egui::StrokeKind::Middle);+ }+ ui.ctx().set_cursor_icon(if on_handle { egui::CursorIcon::ResizeHorizontal } else { egui::CursorIcon::Text });+ // Dragging a box (not while a paragraph is open for typing) moves it; from the handle, resizes it.+ if resp.drag_started()+ && active.is_none()+ && let Some(o) = ui.input(|i| i.pointer.press_origin())+ && let Some(block) = boxes.iter().rposition(|b| b.contains(o) || (upright && width_handle(*b).contains(o)))+ {+ let resize = upright && width_handle(boxes[block]).contains(o);+ view.block_drag = Some(BlockDrag { page, block, start: o, resize });+ return true;+ }if resp.clicked() {let l = &lines[hit];// Screen pixels per point, from the box's width.diff --git a/crates/ui-egui/tests/editing.rs b/crates/ui-egui/tests/editing.rsindex 67084f877..37c9588cf 100644--- a/crates/ui-egui/tests/editing.rs+++ b/crates/ui-egui/tests/editing.rs@@ -862,3 +862,52 @@ fn the_format_panel_restyles_the_paragraph_being_edited() {assert_eq!(doc.text_blocks(0)[0].base_font, "Helvetica-Bold");assert!(s.views[0].line_editor.as_ref().is_some_and(|e| e.extras.underline));}++/// Drag with the pointer from `from` to `to` in a few steps.+fn drag(h: &mut Harness<'static, PrintCraftApp>, from: egui::Pos2, to: egui::Pos2) {+ h.hover_at(from);+ h.run_steps(1);+ h.drag_at(from);+ h.run_steps(1);+ for k in 1..=5 {+ h.hover_at(from + (to - from) * (k as f32 / 5.0));+ h.run_steps(1);+ }+ h.drop_at(to);+ h.run_steps(4);+}++#[test]+fn dragging_a_paragraph_moves_it_and_its_edge_rewraps_it() {+ let mut h = harness(1, |_| {});+ assert!(h.state_mut().execute("edit.edit_text"));+ h.run_steps(2);+ let block = |h: &Harness<'static, PrintCraftApp>| {+ let s = h.state();+ s.session.get(s.views[0].id).unwrap().text_blocks(0)[0].clone()+ };+ // User space (200 × 300 page) → screen.+ let r = h.state().views[0].page_screen_rect(0).expect("on screen");+ let k = r.width() / 200.0;+ let screen = |x: f64, y: f64| egui::pos2(r.left() + x as f32 * k, r.top() + (300.0 - y as f32) * k);+ // Move "Page 1" 30 pt right and 50 pt up.+ let before = block(&h);+ let mid = screen((before.rect[0] + before.rect[2]) / 2.0, (before.rect[1] + before.rect[3]) / 2.0);+ drag(&mut h, mid, mid + egui::vec2(30.0 * k, -50.0 * k));+ assert!(h.state().views[0].line_editor.is_none(), "dragging moves the box; it doesn't open it for typing");+ let moved = block(&h);+ assert_eq!(moved.text, "Page 1");+ let near = |a: f64, b: f64| (a - b).abs() < 1.5;+ assert!(near(moved.rect[0], before.rect[0] + 30.0) && near(moved.rect[1], before.rect[1] + 50.0), "{:?} → {:?}", before.rect, moved.rect);+ assert_eq!(h.state().session.get(h.state().views[0].id).unwrap().can_undo(), Some("Edit text"));+ // Drag the handle on its right edge in to about 45 pt wide: "Page" and "1" rewrap onto two lines.+ let edge = screen(moved.rect[2], (moved.rect[1] + moved.rect[3]) / 2.0) + egui::vec2(2.0, 0.0);+ let narrower = (moved.rect[2] - moved.rect[0] - 45.0) as f32 * k;+ drag(&mut h, edge, edge - egui::vec2(narrower, 0.0));+ let s = h.state();+ let doc = s.session.get(s.views[0].id).unwrap();+ let lines: Vec<String> = doc.text_lines(0).iter().map(|l| l.text.clone()).collect();+ assert_eq!(lines, ["Page", "1"], "rewrapped to the narrower box");+ assert!(near(doc.text_lines(0)[0].rect[0], moved.rect[0]), "it keeps its place");+ assert!(h.state().views[0].line_editor.is_none());+}diff --git a/parity/acrobat-features.toml b/parity/acrobat-features.tomlindex 53ebd6b20..6dd14d159 100644--- a/parity/acrobat-features.toml+++ b/parity/acrobat-features.toml@@ -1795,7 +1795,7 @@ status = "partial"commands = ["edit.edit_text"]tools = ["text_lines", "text_paragraphs", "text_edit"]evidence = ["crates/edit/src/tests.rs::paragraphs_are_found_and_rewrapped", "crates/edit/src/tests.rs::text_lines_are_found_and_replaced_in_place", "crates/ui-egui/tests/editing.rs::editing_existing_text_in_place", "crates/automation/tests/automation.rs::editing_existing_text_through_tools"]-notes = "click a paragraph box and retype it in place (font reused or Helvetica substituted, colour and spacing kept, rewrapped); per-character formatting changes and moving or resizing boxes are next"+notes = "click a paragraph box and retype it in place (font reused or Helvetica substituted, colour and spacing kept, rewrapped); drag a box to move it or its right-edge handle to rewrap it (edit.text-move-resize); per-character formatting changes are next"[[feature]]id = "edit.text-reflow"@@ -1809,6 +1809,18 @@ tools = ["text_edit"]evidence = ["crates/edit/src/tests.rs::paragraphs_are_found_and_rewrapped", "crates/edit/src/tests.rs::text_lines_are_found_and_replaced_in_place", "crates/ui-egui/tests/editing.rs::editing_existing_text_in_place", "crates/automation/tests/automation.rs::editing_existing_text_through_tools"]notes = "edited paragraphs are rewrapped to the box width with the font's own advance widths and the original line spacing, starting at the original text matrix; text state and fill colour restored after; a single line grows to the right margin"+[[feature]]+id = "edit.text-move-resize"+title = "Move and resize text boxes"+area = "C"+tier = "P0"+milestone = "M7"+status = "shipped"+commands = ["edit.edit_text"]+tools = ["text_edit"]+evidence = ["crates/edit/src/tests.rs::paragraphs_move_and_rewrap_to_a_new_width", "crates/ui-egui/tests/editing.rs::dragging_a_paragraph_moves_it_and_its_edge_rewraps_it", "crates/automation/tests/automation.rs::editing_existing_text_through_tools"]+notes = "existing paragraphs: drag the box to move it, drag the handle on its right edge to rewrap it to a new width (upright pages); the move is applied in page space through the paragraph's CTM, in its own q … Q; a click still opens it for typing (#40)"+[[feature]]id = "edit.paragraph-detection"title = "Detect paragraphs and text blocks for editing"