diff options
author | 2023-12-01 16:04:27 +0100 | |
---|---|---|
committer | 2023-12-01 16:04:27 +0100 | |
commit | 936d480267578d7e80675e78ec1880aaaaab72d6 (patch) | |
tree | 70719766c67dd6a09630c5a4231e952a3200bea1 /wgpu/src/geometry.rs | |
parent | 99899d49cc93cdec3832f7b5ecad867fdd421e07 (diff) | |
download | iced-936d480267578d7e80675e78ec1880aaaaab72d6.tar.gz iced-936d480267578d7e80675e78ec1880aaaaab72d6.tar.bz2 iced-936d480267578d7e80675e78ec1880aaaaab72d6.zip |
Clip text to `viewport` bounds instead of layout bounds
Diffstat (limited to 'wgpu/src/geometry.rs')
-rw-r--r-- | wgpu/src/geometry.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/wgpu/src/geometry.rs b/wgpu/src/geometry.rs index 655362b7..c82b9ffb 100644 --- a/wgpu/src/geometry.rs +++ b/wgpu/src/geometry.rs @@ -328,15 +328,17 @@ impl Frame { Point::new(transformed.x, transformed.y) }; + let bounds = Rectangle { + x: position.x, + y: position.y, + width: f32::INFINITY, + height: f32::INFINITY, + }; + // TODO: Use vectorial text instead of primitive self.primitives.push(Primitive::Text { content: text.content, - bounds: Rectangle { - x: position.x, - y: position.y, - width: f32::INFINITY, - height: f32::INFINITY, - }, + bounds, color: text.color, size: text.size, line_height: text.line_height, @@ -344,6 +346,7 @@ impl Frame { horizontal_alignment: text.horizontal_alignment, vertical_alignment: text.vertical_alignment, shaping: text.shaping, + viewport: bounds, }); } |