mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
🐛 Fix layout and constraints not being cleared
This commit is contained in:
@@ -347,6 +347,11 @@ impl Shape {
|
||||
self.vertical_align
|
||||
}
|
||||
|
||||
pub fn clear_constraints(&mut self) {
|
||||
self.constraint_h = None;
|
||||
self.constraint_v = None;
|
||||
}
|
||||
|
||||
pub fn set_constraint_h(&mut self, constraint: Option<ConstraintH>) {
|
||||
self.constraint_h = constraint;
|
||||
}
|
||||
@@ -402,6 +407,13 @@ impl Shape {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn clear_layout(&mut self) {
|
||||
self.layout_item = None;
|
||||
if let Type::Frame(data) = &mut self.shape_type {
|
||||
data.layout = None;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: These arguments could be grouped or simplified
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn set_flex_layout_data(
|
||||
|
||||
@@ -16,6 +16,13 @@ pub extern "C" fn set_shape_constraint_v(constraint: u8) {
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn clear_shape_constraints() {
|
||||
with_current_shape_mut!(state, |shape: &mut Shape| {
|
||||
shape.clear_constraints();
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn set_shape_vertical_align(align: u8) {
|
||||
with_current_shape_mut!(state, |shape: &mut Shape| {
|
||||
@@ -23,6 +30,13 @@ pub extern "C" fn set_shape_vertical_align(align: u8) {
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn clear_shape_layout() {
|
||||
with_current_shape_mut!(state, |shape: &mut Shape| {
|
||||
shape.clear_layout();
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn set_flex_layout_data(
|
||||
dir: u8,
|
||||
|
||||
Reference in New Issue
Block a user