mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
Merge pull request #6958 from penpot/superalex-fix-texts-bigger-than-selrects-in-multiple-tiles
🐛 Fix rendering texts bigger than their selrects in mutiple tiles
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user