summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/main/viewport.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index d9903636df..104806d891 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1516,7 +1516,8 @@ Control* Viewport::_gui_find_control(const Point2& p_global) {
CanvasItem *pci = sw->get_parent_item();
if (pci)
xform=pci->get_global_transform_with_canvas();
-
+ else
+ xform=sw->get_canvas_transform();
Control *ret = _gui_find_control_at_pos(sw,p_global,xform,gui.focus_inv_xform);
if (ret)
@@ -1535,6 +1536,8 @@ Control* Viewport::_gui_find_control(const Point2& p_global) {
CanvasItem *pci = sw->get_parent_item();
if (pci)
xform=pci->get_global_transform_with_canvas();
+ else
+ xform=sw->get_canvas_transform();
Control *ret = _gui_find_control_at_pos(sw,p_global,xform,gui.focus_inv_xform);
@@ -1654,7 +1657,7 @@ void Viewport::_gui_input_event(InputEvent p_event) {
- Matrix32 parent_xform;
+ //Matrix32 parent_xform;
//if (data.parent_canvas_item)
// parent_xform=data.parent_canvas_item->get_global_transform();
@@ -2207,7 +2210,7 @@ void Viewport::_gui_grab_click_focus(Control *p_control) {
//send unclic
- Point2 click =gui.mouse_focus->get_global_transform().affine_inverse().xform(gui.last_mouse_pos);
+ Point2 click =gui.mouse_focus->get_global_transform_with_canvas().affine_inverse().xform(gui.last_mouse_pos);
mb.x=click.x;
mb.y=click.y;
mb.button_index=gui.mouse_focus_button;
@@ -2216,8 +2219,8 @@ void Viewport::_gui_grab_click_focus(Control *p_control) {
gui.mouse_focus=p_control;
- gui.focus_inv_xform=gui.mouse_focus->get_global_transform().affine_inverse();
- click =gui.mouse_focus->get_global_transform().affine_inverse().xform(gui.last_mouse_pos);
+ gui.focus_inv_xform=gui.mouse_focus->get_global_transform_with_canvas().affine_inverse();
+ click =gui.mouse_focus->get_global_transform_with_canvas().affine_inverse().xform(gui.last_mouse_pos);
mb.x=click.x;
mb.y=click.y;
mb.button_index=gui.mouse_focus_button;