summaryrefslogtreecommitdiffstats
path: root/graphics/src/primitive.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-12-01 16:04:27 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-12-01 16:04:27 +0100
commit936d480267578d7e80675e78ec1880aaaaab72d6 (patch)
tree70719766c67dd6a09630c5a4231e952a3200bea1 /graphics/src/primitive.rs
parent99899d49cc93cdec3832f7b5ecad867fdd421e07 (diff)
downloadiced-936d480267578d7e80675e78ec1880aaaaab72d6.tar.gz
iced-936d480267578d7e80675e78ec1880aaaaab72d6.tar.bz2
iced-936d480267578d7e80675e78ec1880aaaaab72d6.zip
Clip text to `viewport` bounds instead of layout bounds
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..837eb77a 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 viewport of the text.
+ viewport: Rectangle,
},
/// A paragraph primitive
Paragraph {
@@ -41,15 +43,19 @@ pub enum Primitive<T> {
position: Point,
/// The color of the paragraph.
color: Color,
+ /// The viewport of the paragraph.
+ viewport: 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 viewport of the editor.
+ viewport: Rectangle,
},
/// A quad primitive
Quad {