mirror of
https://github.com/penpot/penpot.git
synced 2026-08-06 04:48:39 +00:00
🐛 Fix wrong text auto width/height layout
This commit is contained in:
parent
40b34da788
commit
c097aef152
@ -791,6 +791,7 @@
|
|||||||
(rx/subs! (fn [_]
|
(rx/subs! (fn [_]
|
||||||
(clear-drawing-cache)
|
(clear-drawing-cache)
|
||||||
(request-render "pending-finished")
|
(request-render "pending-finished")
|
||||||
|
(h/call wasm/internal-module "_update_shape_text_layout_for_all")
|
||||||
(.dispatchEvent ^js js/document event))))
|
(.dispatchEvent ^js js/document event))))
|
||||||
(do
|
(do
|
||||||
(clear-drawing-cache)
|
(clear-drawing-cache)
|
||||||
|
|||||||
@ -78,4 +78,13 @@ impl ShapesPool {
|
|||||||
let idx = *self.shapes_uuid_to_idx.get(id)?;
|
let idx = *self.shapes_uuid_to_idx.get(id)?;
|
||||||
Some(&self.shapes[idx])
|
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]
|
#[no_mangle]
|
||||||
pub extern "C" fn get_caret_position_at(x: f32, y: f32) -> i32 {
|
pub extern "C" fn get_caret_position_at(x: f32, y: f32) -> i32 {
|
||||||
with_current_shape!(state, |shape: &Shape| {
|
with_current_shape!(state, |shape: &Shape| {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user