mirror of
https://github.com/penpot/penpot.git
synced 2026-02-12 22:53:02 +00:00
🐛 Fix wrong text auto width/height layout
This commit is contained in:
@@ -791,6 +791,7 @@
|
||||
(rx/subs! (fn [_]
|
||||
(clear-drawing-cache)
|
||||
(request-render "pending-finished")
|
||||
(h/call wasm/internal-module "_update_shape_text_layout_for_all")
|
||||
(.dispatchEvent ^js js/document event))))
|
||||
(do
|
||||
(clear-drawing-cache)
|
||||
|
||||
@@ -78,4 +78,13 @@ impl ShapesPool {
|
||||
let idx = *self.shapes_uuid_to_idx.get(id)?;
|
||||
Some(&self.shapes[idx])
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn iter(&self) -> std::slice::Iter<'_, Shape> {
|
||||
self.shapes.iter()
|
||||
}
|
||||
|
||||
pub fn iter_mut(&mut self) -> std::slice::IterMut<'_, Shape> {
|
||||
self.shapes.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +384,17 @@ pub extern "C" fn update_shape_text_layout_for(a: u32, b: u32, c: u32, d: u32) {
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn update_shape_text_layout_for_all() {
|
||||
with_state_mut!(state, {
|
||||
for shape in state.shapes.iter_mut() {
|
||||
if let Type::Text(text_content) = &mut shape.shape_type {
|
||||
text_content.update_layout(shape.selrect);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn get_caret_position_at(x: f32, y: f32) -> i32 {
|
||||
with_current_shape!(state, |shape: &Shape| {
|
||||
|
||||
Reference in New Issue
Block a user