mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
♻️ Rename TextContent::get_width to TextContent::width
This commit is contained in:
@@ -19,7 +19,7 @@ pub fn render(
|
||||
|
||||
// Width
|
||||
let paragraph_width = if let crate::shapes::Type::Text(text_content) = &shape.shape_type {
|
||||
text_content.get_width()
|
||||
text_content.width()
|
||||
} else {
|
||||
shape.width()
|
||||
};
|
||||
|
||||
@@ -212,7 +212,7 @@ fn propagate_transform(
|
||||
transform.post_concat(&resize_transform);
|
||||
}
|
||||
GrowType::AutoWidth => {
|
||||
let paragraph_width = content.get_width();
|
||||
let paragraph_width = content.width();
|
||||
let mut paragraphs = content.to_paragraphs(None, None, None);
|
||||
let height = auto_height(&mut paragraphs, paragraph_width);
|
||||
let resize_transform = math::resize_matrix(
|
||||
|
||||
@@ -66,11 +66,6 @@ impl TextContent {
|
||||
self.bounds = Rect::from_xywh(x, y, w, h);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn width(&self) -> f32 {
|
||||
self.bounds.width()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn x(&self) -> f32 {
|
||||
self.bounds.x()
|
||||
@@ -178,13 +173,13 @@ impl TextContent {
|
||||
paragraph_group
|
||||
}
|
||||
|
||||
pub fn get_width(&self) -> f32 {
|
||||
pub fn width(&self) -> f32 {
|
||||
if self.grow_type() == GrowType::AutoWidth {
|
||||
let temp_paragraphs = self.to_paragraphs(None, None, None);
|
||||
let mut temp_paragraphs = temp_paragraphs;
|
||||
auto_width(&mut temp_paragraphs, f32::MAX).ceil()
|
||||
} else {
|
||||
self.width()
|
||||
self.bounds.width()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +192,7 @@ impl TextContent {
|
||||
}
|
||||
|
||||
pub fn visual_bounds(&self) -> (f32, f32) {
|
||||
let paragraph_width = self.get_width();
|
||||
let paragraph_width = self.width();
|
||||
let mut paragraphs = self.to_paragraphs(None, None, None);
|
||||
let paragraph_height = auto_height(&mut paragraphs, paragraph_width);
|
||||
(paragraph_width, paragraph_height)
|
||||
|
||||
@@ -43,7 +43,7 @@ pub extern "C" fn get_text_dimensions() -> *mut u8 {
|
||||
|
||||
if let Type::Text(content) = &shape.shape_type {
|
||||
// 1. Reset Paragraphs
|
||||
let paragraph_width = content.get_width();
|
||||
let paragraph_width = content.width();
|
||||
let mut paragraphs = content.to_paragraphs(None, None, None);
|
||||
let built_paragraphs = build_paragraphs_with_width(&mut paragraphs, paragraph_width);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user