-Take in consideration canvas layers for GUI input

This commit is contained in:
Juan Linietsky 2016-01-24 10:57:42 -03:00
parent c247f5ad61
commit 35a28f3442
4 changed files with 17 additions and 1 deletions

View File

@ -1193,6 +1193,14 @@ bool CanvasItem::is_local_transform_notification_enabled() const {
return notify_local_transform;
}
int CanvasItem::get_canvas_layer() const {
if (canvas_layer)
return canvas_layer->get_layer();
else
return 0;
}
CanvasItem::CanvasItem() : xform_change(this) {

View File

@ -268,6 +268,7 @@ public:
void set_notify_local_transform(bool p_enable);
bool is_local_transform_notification_enabled() const;
int get_canvas_layer() const;
CanvasItem();
~CanvasItem();

View File

@ -2071,6 +2071,8 @@ Control *Control::get_root_parent_control() const {
return const_cast<Control*>(root);
}
void Control::_bind_methods() {

View File

@ -97,7 +97,12 @@ private:
struct CComparator {
bool operator()(const Control* p_a, const Control* p_b) const { return p_b->is_greater_than(p_a); }
bool operator()(const Control* p_a, const Control* p_b) const {
if (p_a->get_canvas_layer()==p_b->get_canvas_layer())
return p_b->is_greater_than(p_a);
else
return p_a->get_canvas_layer() < p_b->get_canvas_layer();
}
};
struct Data {