EPS import: joined text lays out its bounds afresh

The pieces joined into one text kept the layout cached for the first piece, so the selection box covered only that piece.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Matthew Farrow 2026-10-08 22:06:22 -04:00
parent 2dc738b816
commit 94dfa20fa0
2 changed files with 6 additions and 0 deletions

View File

@ -798,6 +798,9 @@ fn join_pieces(parts: &mut Vec<Arc<Node>>, lines: &[(String, Point)]) {
&& let NodeKind::Text(t) = &mut node.kind
{
t.runs = runs.into_iter().flatten().collect();
// The layout cached for the first piece is not this text's.
t.cached_bounds = None;
t.cached_baselines.clear();
}
let mut gone: Vec<usize> = rest.clone();
gone.sort_unstable_by(|a, b| b.cmp(a));

View File

@ -423,6 +423,9 @@ fn a_line_the_page_draws_in_pieces_goes_to_its_text_object_whole() {
let texts: Vec<String> =
group.children().unwrap().iter().filter_map(|n| if let NodeKind::Text(t) = &n.kind { Some(t.plain_text()) } else { None }).collect();
assert_eq!(texts, ["Hi there"]);
// Its bounds are laid out afresh for the whole text, not those of the first piece.
let NodeKind::Text(t) = &group.children().unwrap()[0].kind else { panic!("text") };
assert!(t.cached_bounds.is_none() && t.cached_baselines.is_empty());
}
#[test]