diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-24 10:57:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-24 10:57:42 -0300 |
commit | 35a28f34426eb6c44a5e321bbd630c64d8b38de0 (patch) | |
tree | b1bffbbe03280874103f4bcd3d89f5ebad6c0800 /scene | |
parent | c247f5ad61f2575c321fb8117ed4212611e8cdf4 (diff) |
-Take in consideration canvas layers for GUI input
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/canvas_item.cpp | 8 | ||||
-rw-r--r-- | scene/2d/canvas_item.h | 1 | ||||
-rw-r--r-- | scene/gui/control.cpp | 2 | ||||
-rw-r--r-- | scene/gui/control.h | 7 |
4 files changed, 17 insertions, 1 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 35b453d71d..316097fbcf 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -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) { diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 5d10523261..05a2e725e9 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -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(); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index dce0a4ac0e..71a0f50240 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2071,6 +2071,8 @@ Control *Control::get_root_parent_control() const { return const_cast<Control*>(root); } + + void Control::_bind_methods() { diff --git a/scene/gui/control.h b/scene/gui/control.h index a16d88a6df..74d40b7579 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -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 { |