diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-19 09:07:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-19 09:07:07 +0100 |
commit | 417698c2023397f801951358565c6016fd6202f4 (patch) | |
tree | 9b749047304f1a26f0efacba0dd803e18cc83118 /scene/gui | |
parent | 8aed7c1c09e7f6fa902d607d86cc8f6688bf3fb5 (diff) | |
parent | 415042ac89d1c9c7f8ca97fa83fc1165350a01da (diff) |
Merge pull request #58042 from Sauermann/fix-viewport-border-notifications
Fix Viewport mouse enter+exit notifications
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/subviewport_container.cpp | 18 | ||||
-rw-r--r-- | scene/gui/subviewport_container.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp index ce78c286f5..c66e145bc4 100644 --- a/scene/gui/subviewport_container.cpp +++ b/scene/gui/subviewport_container.cpp @@ -148,6 +148,24 @@ void SubViewportContainer::_notification(int p_what) { } } } break; + + case NOTIFICATION_MOUSE_ENTER: { + _notify_viewports(NOTIFICATION_VP_MOUSE_ENTER); + } break; + + case NOTIFICATION_MOUSE_EXIT: { + _notify_viewports(NOTIFICATION_VP_MOUSE_EXIT); + } break; + } +} + +void SubViewportContainer::_notify_viewports(int p_notification) { + for (int i = 0; i < get_child_count(); i++) { + SubViewport *c = Object::cast_to<SubViewport>(get_child(i)); + if (!c) { + continue; + } + c->notification(p_notification); } } diff --git a/scene/gui/subviewport_container.h b/scene/gui/subviewport_container.h index 3138a6144c..f52f01e4e2 100644 --- a/scene/gui/subviewport_container.h +++ b/scene/gui/subviewport_container.h @@ -38,6 +38,7 @@ class SubViewportContainer : public Container { bool stretch = false; int shrink = 1; + void _notify_viewports(int p_notification); protected: void _notification(int p_what); |