🐛 Fix rendering texts bigger than their selrects in mutiple tiles

This commit is contained in:
Alejandro Alonso 2025-07-25 12:56:57 +02:00 committed by Elena Torro
parent 0e20bb6271
commit b70f6af2df
2 changed files with 13 additions and 0 deletions

View file

@ -705,6 +705,7 @@ impl Shape {
};
max_stroke = max_stroke.max(width);
}
let mut rect = if let Some(path) = self.get_skia_path() {
path.compute_tight_bounds()
.with_outset((max_stroke, max_stroke))
@ -720,6 +721,12 @@ impl Shape {
bounds_rect
};
if let Type::Text(ref text_content) = self.shape_type {
let (width, height) = text_content.visual_bounds();
rect.right = rect.left + width;
rect.bottom = rect.top + height;
}
for shadow in self.shadows.iter() {
let (x, y) = shadow.offset;
let mut shadow_rect = rect;

View file

@ -175,6 +175,12 @@ impl TextContent {
pub fn set_grow_type(&mut self, grow_type: GrowType) {
self.grow_type = grow_type;
}
pub fn visual_bounds(&self) -> (f32, f32) {
let mut paragraphs = self.to_paragraphs();
let height = auto_height(&mut paragraphs, self.width());
(self.width(), height)
}
}
impl Default for TextContent {