diff options
author | 2023-12-02 16:10:42 +0100 | |
---|---|---|
committer | 2023-12-02 16:10:42 +0100 | |
commit | 8727b3fc50ec251d9c117c51ca1289be5ba9b117 (patch) | |
tree | 802fef9f0b54b6f9cbbeedff14d7f57169db7d6b /wgpu/src/text.rs | |
parent | 7f8b17604a31e00becc43130ec516c1a53552c88 (diff) | |
parent | b526ce4958b28208395276dd4078ffe0d780e1d7 (diff) | |
download | iced-8727b3fc50ec251d9c117c51ca1289be5ba9b117.tar.gz iced-8727b3fc50ec251d9c117c51ca1289be5ba9b117.tar.bz2 iced-8727b3fc50ec251d9c117c51ca1289be5ba9b117.zip |
Merge pull request #2154 from iced-rs/fix/text-clipping
Fix text clipping
Diffstat (limited to 'wgpu/src/text.rs')
-rw-r--r-- | wgpu/src/text.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index 08a8bea6..888b1924 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -120,9 +120,13 @@ impl Pipeline { horizontal_alignment, vertical_alignment, color, + clip_bounds, ) = match section { Text::Paragraph { - position, color, .. + position, + color, + clip_bounds, + .. } => { use crate::core::text::Paragraph as _; @@ -137,10 +141,14 @@ impl Pipeline { paragraph.horizontal_alignment(), paragraph.vertical_alignment(), *color, + *clip_bounds, ) } Text::Editor { - position, color, .. + position, + color, + clip_bounds, + .. } => { use crate::core::text::Editor as _; @@ -155,6 +163,7 @@ impl Pipeline { alignment::Horizontal::Left, alignment::Vertical::Top, *color, + *clip_bounds, ) } Text::Cached(text) => { @@ -173,6 +182,7 @@ impl Pipeline { text.horizontal_alignment, text.vertical_alignment, text.color, + text.clip_bounds, ) } }; @@ -195,13 +205,8 @@ impl Pipeline { alignment::Vertical::Bottom => bounds.y - bounds.height, }; - let section_bounds = Rectangle { - x: left, - y: top, - ..bounds - }; - - let clip_bounds = layer_bounds.intersection(§ion_bounds)?; + let clip_bounds = + layer_bounds.intersection(&(clip_bounds * scale_factor))?; Some(glyphon::TextArea { buffer, |