diff options
| author | Juan Linietsky | 2016-01-19 20:27:27 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2016-01-19 20:28:20 -0300 |
| commit | 891e31b139b269fb154d30b8c7d7887267708d8b (patch) | |
| tree | 65e3c85540d003200592dd2847fe148bee01ad7d /scene/gui/control.cpp | |
| parent | d67df42cc864c3bc5cd1911406e284c3cb84f8e8 (diff) | |
| download | godot-891e31b139b269fb154d30b8c7d7887267708d8b.tar.gz godot-891e31b139b269fb154d30b8c7d7887267708d8b.tar.zst godot-891e31b139b269fb154d30b8c7d7887267708d8b.zip | |
-Some fixes to drag and drop and canvas offset for GUI that were introduced after rewrite
Diffstat (limited to 'scene/gui/control.cpp')
| -rw-r--r-- | scene/gui/control.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 90c72989b..8f6a0b4d5 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -606,14 +606,14 @@ void Control::force_drag(const Variant& p_data,Control *p_control) { ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(p_data.get_type()==Variant::NIL); - get_viewport()->_gui_force_drag(p_data,p_control); + get_viewport()->_gui_force_drag(this,p_data,p_control); } void Control::set_drag_preview(Control *p_control) { ERR_FAIL_COND(!is_inside_tree()); - get_viewport()->_gui_set_drag_preview(p_control); + get_viewport()->_gui_set_drag_preview(this,p_control); } @@ -2046,6 +2046,26 @@ Vector2 Control::get_scale() const{ return data.scale; } +Control *Control::get_root_parent_control() const { + + const CanvasItem *ci=this; + const Control *root=this; + + while(ci) { + + const Control *c = ci->cast_to<Control>(); + if (c) { + root=c; + + if (c->data.RI || c->data.MI || c->is_toplevel_control()) + break; + } + + ci=ci->get_parent_item(); + } + + return const_cast<Control*>(root); +} void Control::_bind_methods() { |
