summaryrefslogtreecommitdiffstats
path: root/graphics/src/primitive.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2023-12-02 16:10:42 +0100
committerLibravatar GitHub <noreply@github.com>2023-12-02 16:10:42 +0100
commit8727b3fc50ec251d9c117c51ca1289be5ba9b117 (patch)
tree802fef9f0b54b6f9cbbeedff14d7f57169db7d6b /graphics/src/primitive.rs
parent7f8b17604a31e00becc43130ec516c1a53552c88 (diff)
parentb526ce4958b28208395276dd4078ffe0d780e1d7 (diff)
downloadiced-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 'graphics/src/primitive.rs')
-rw-r--r--graphics/src/primitive.rs26
1 files changed, 16 insertions, 10 deletions
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs
index 4ed512c1..ed75776c 100644
--- a/graphics/src/primitive.rs
+++ b/graphics/src/primitive.rs
@@ -14,24 +14,26 @@ use std::sync::Arc;
pub enum Primitive<T> {
/// A text primitive
Text {
- /// The contents of the text
+ /// The contents of the text.
content: String,
- /// The bounds of the text
+ /// The bounds of the text.
bounds: Rectangle,
- /// The color of the text
+ /// The color of the text.
color: Color,
- /// The size of the text in logical pixels
+ /// The size of the text in logical pixels.
size: Pixels,
- /// The line height of the text
+ /// The line height of the text.
line_height: text::LineHeight,
- /// The font of the text
+ /// The font of the text.
font: Font,
- /// The horizontal alignment of the text
+ /// The horizontal alignment of the text.
horizontal_alignment: alignment::Horizontal,
- /// The vertical alignment of the text
+ /// The vertical alignment of the text.
vertical_alignment: alignment::Vertical,
/// The shaping strategy of the text.
shaping: text::Shaping,
+ /// The clip bounds of the text.
+ clip_bounds: Rectangle,
},
/// A paragraph primitive
Paragraph {
@@ -41,15 +43,19 @@ pub enum Primitive<T> {
position: Point,
/// The color of the paragraph.
color: Color,
+ /// The clip bounds of the paragraph.
+ clip_bounds: Rectangle,
},
/// An editor primitive
Editor {
/// The [`editor::Weak`] reference.
editor: editor::Weak,
- /// The position of the paragraph.
+ /// The position of the editor.
position: Point,
- /// The color of the paragraph.
+ /// The color of the editor.
color: Color,
+ /// The clip bounds of the editor.
+ clip_bounds: Rectangle,
},
/// A quad primitive
Quad {