You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Merge pull request #23407 from bojidar-bg/3281-ysort-recursive
Y-Sort children together in nested YSorts
This commit is contained in:
@@ -48,6 +48,9 @@ public:
|
||||
bool use_parent_material;
|
||||
int index;
|
||||
bool children_order_dirty;
|
||||
int ysort_children_count;
|
||||
Transform2D ysort_xform;
|
||||
Vector2 ysort_pos;
|
||||
|
||||
Vector<Item *> child_items;
|
||||
|
||||
@@ -61,6 +64,9 @@ public:
|
||||
use_parent_material = false;
|
||||
z_relative = true;
|
||||
index = 0;
|
||||
ysort_children_count = -1;
|
||||
ysort_xform = Transform2D();
|
||||
ysort_pos = Vector2();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,10 +82,10 @@ public:
|
||||
|
||||
_FORCE_INLINE_ bool operator()(const Item *p_left, const Item *p_right) const {
|
||||
|
||||
if (Math::abs(p_left->xform.elements[2].y - p_right->xform.elements[2].y) < CMP_EPSILON)
|
||||
return p_left->xform.elements[2].x < p_right->xform.elements[2].x;
|
||||
if (Math::abs(p_left->ysort_pos.y - p_right->ysort_pos.y) < CMP_EPSILON)
|
||||
return p_left->ysort_pos.x < p_right->ysort_pos.x;
|
||||
else
|
||||
return p_left->xform.elements[2].y < p_right->xform.elements[2].y;
|
||||
return p_left->ysort_pos.y < p_right->ysort_pos.y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user