diff options
author | 2024-04-10 16:26:55 +0200 | |
---|---|---|
committer | 2024-04-10 16:26:55 +0200 | |
commit | 32cd456fb936117307c178b4d47ae89124c8329a (patch) | |
tree | 6eafe77cc00eef587b489c6aa62d231bf0581659 | |
parent | 1e802e776cb591f3860d1bfbaa1423d356fc8456 (diff) | |
download | iced-32cd456fb936117307c178b4d47ae89124c8329a.tar.gz iced-32cd456fb936117307c178b4d47ae89124c8329a.tar.bz2 iced-32cd456fb936117307c178b4d47ae89124c8329a.zip |
Account for `transformation` in `Text::visible_bounds`
-rw-r--r-- | graphics/src/text.rs | 8 | ||||
-rw-r--r-- | tiny_skia/src/layer.rs | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/graphics/src/text.rs b/graphics/src/text.rs index 31b6de28..30269e69 100644 --- a/graphics/src/text.rs +++ b/graphics/src/text.rs @@ -78,10 +78,12 @@ impl Text { position, paragraph, clip_bounds, + transformation, .. } => ( Rectangle::new(*position, paragraph.min_bounds) - .intersection(clip_bounds), + .intersection(clip_bounds) + .map(|bounds| bounds * *transformation), Some(paragraph.horizontal_alignment), Some(paragraph.vertical_alignment), ), @@ -89,10 +91,12 @@ impl Text { editor, position, clip_bounds, + transformation, .. } => ( Rectangle::new(*position, editor.bounds) - .intersection(clip_bounds), + .intersection(clip_bounds) + .map(|bounds| bounds * *transformation), None, None, ), diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index 0d770d81..17e6ac13 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -200,9 +200,7 @@ impl Layer { |text| { text.visible_bounds() .into_iter() - .filter_map(|bounds| { - bounds.intersection(&text_a.clip_bounds()) - }) + .map(|bounds| bounds * text_a.transformation()) .collect() }, |text_a, text_b| text_a == text_b, |