mirror of
https://github.com/penpot/penpot.git
synced 2026-09-12 15:09:38 +00:00
🐛 Fix z-ordering for flex elements
This commit is contained in:
parent
0a700864c9
commit
76f6f71e02
@ -1472,6 +1472,10 @@ impl RenderState {
|
|||||||
|
|
||||||
// Z-index ordering on Layouts
|
// Z-index ordering on Layouts
|
||||||
if element.has_layout() {
|
if element.has_layout() {
|
||||||
|
if element.is_flex() && !element.is_flex_reverse() {
|
||||||
|
children_ids.reverse();
|
||||||
|
}
|
||||||
|
|
||||||
children_ids.sort_by(|id1, id2| {
|
children_ids.sort_by(|id1, id2| {
|
||||||
let z1 = tree.get(id1).map_or_else(|| 0, |s| s.z_index());
|
let z1 = tree.get(id1).map_or_else(|| 0, |s| s.z_index());
|
||||||
let z2 = tree.get(id2).map_or_else(|| 0, |s| s.z_index());
|
let z2 = tree.get(id2).map_or_else(|| 0, |s| s.z_index());
|
||||||
|
|||||||
@ -328,6 +328,28 @@ impl Shape {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_flex(&self) -> bool {
|
||||||
|
matches!(
|
||||||
|
self.shape_type,
|
||||||
|
Type::Frame(Frame {
|
||||||
|
layout: Some(layouts::Layout::FlexLayout(_, _)),
|
||||||
|
..
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_flex_reverse(&self) -> bool {
|
||||||
|
matches!(
|
||||||
|
self.shape_type,
|
||||||
|
Type::Frame(Frame {
|
||||||
|
layout: Some(layouts::Layout::FlexLayout(_, FlexData {
|
||||||
|
direction: layouts::FlexDirection::RowReverse | layouts::FlexDirection::ColumnReverse, ..
|
||||||
|
})),
|
||||||
|
..
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_selrect(&mut self, left: f32, top: f32, right: f32, bottom: f32) {
|
pub fn set_selrect(&mut self, left: f32, top: f32, right: f32, bottom: f32) {
|
||||||
self.invalidate_bounds();
|
self.invalidate_bounds();
|
||||||
self.invalidate_extrect();
|
self.invalidate_extrect();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user