summaryrefslogtreecommitdiffstats
path: root/graphics/src/damage.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/damage.rs')
-rw-r--r--graphics/src/damage.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/graphics/src/damage.rs b/graphics/src/damage.rs
index 2f29956e..595cc274 100644
--- a/graphics/src/damage.rs
+++ b/graphics/src/damage.rs
@@ -40,6 +40,39 @@ impl<T: Damage> Damage for Primitive<T> {
bounds.expand(1.5)
}
+ Self::Paragraph {
+ paragraph,
+ position,
+ ..
+ } => {
+ let mut bounds =
+ Rectangle::new(*position, paragraph.min_bounds);
+
+ bounds.x = match paragraph.horizontal_alignment {
+ alignment::Horizontal::Left => bounds.x,
+ alignment::Horizontal::Center => {
+ bounds.x - bounds.width / 2.0
+ }
+ alignment::Horizontal::Right => bounds.x - bounds.width,
+ };
+
+ bounds.y = match paragraph.vertical_alignment {
+ alignment::Vertical::Top => bounds.y,
+ alignment::Vertical::Center => {
+ bounds.y - bounds.height / 2.0
+ }
+ alignment::Vertical::Bottom => bounds.y - bounds.height,
+ };
+
+ bounds.expand(1.5)
+ }
+ Self::Editor {
+ editor, position, ..
+ } => {
+ let bounds = Rectangle::new(*position, editor.bounds);
+
+ bounds.expand(1.5)
+ }
Self::Quad { bounds, .. }
| Self::Image { bounds, .. }
| Self::Svg { bounds, .. } => bounds.expand(1.0),