mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
🐛 Fix rendering texts bigger than their selrects in mutiple tiles
This commit is contained in:
parent
0e20bb6271
commit
b70f6af2df
2 changed files with 13 additions and 0 deletions
|
@ -705,6 +705,7 @@ impl Shape {
|
||||||
};
|
};
|
||||||
max_stroke = max_stroke.max(width);
|
max_stroke = max_stroke.max(width);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut rect = if let Some(path) = self.get_skia_path() {
|
let mut rect = if let Some(path) = self.get_skia_path() {
|
||||||
path.compute_tight_bounds()
|
path.compute_tight_bounds()
|
||||||
.with_outset((max_stroke, max_stroke))
|
.with_outset((max_stroke, max_stroke))
|
||||||
|
@ -720,6 +721,12 @@ impl Shape {
|
||||||
bounds_rect
|
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() {
|
for shadow in self.shadows.iter() {
|
||||||
let (x, y) = shadow.offset;
|
let (x, y) = shadow.offset;
|
||||||
let mut shadow_rect = rect;
|
let mut shadow_rect = rect;
|
||||||
|
|
|
@ -175,6 +175,12 @@ impl TextContent {
|
||||||
pub fn set_grow_type(&mut self, grow_type: GrowType) {
|
pub fn set_grow_type(&mut self, grow_type: GrowType) {
|
||||||
self.grow_type = grow_type;
|
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 {
|
impl Default for TextContent {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue