You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-24 15:26:15 +00:00
Make mouse-enter/exit notifications match mouse event propagation
`NOTIFICATION_MOUSE_ENTER` and `NOTIFICATION_MOUSE_EXIT` now includes the areas of children control nodes if the mouse filters allow it. In order to check if a Control node itself was entered/exited, the newly introduced `NOTIFICATION_MOUSE_ENTER_SELF` and `NOTIFICATION_MOUSE_EXIT_SELF` can be used. Co-authored-by: Markus Sauermann <6299227+Sauermann@users.noreply.github.com>
This commit is contained in:
@@ -1831,9 +1831,18 @@ bool Control::has_point(const Point2 &p_point) const {
|
||||
void Control::set_mouse_filter(MouseFilter p_filter) {
|
||||
ERR_MAIN_THREAD_GUARD;
|
||||
ERR_FAIL_INDEX(p_filter, 3);
|
||||
|
||||
if (data.mouse_filter == p_filter) {
|
||||
return;
|
||||
}
|
||||
|
||||
data.mouse_filter = p_filter;
|
||||
notify_property_list_changed();
|
||||
update_configuration_warnings();
|
||||
|
||||
if (get_viewport()) {
|
||||
get_viewport()->_gui_update_mouse_over();
|
||||
}
|
||||
}
|
||||
|
||||
Control::MouseFilter Control::get_mouse_filter() const {
|
||||
@@ -3568,6 +3577,8 @@ void Control::_bind_methods() {
|
||||
BIND_CONSTANT(NOTIFICATION_RESIZED);
|
||||
BIND_CONSTANT(NOTIFICATION_MOUSE_ENTER);
|
||||
BIND_CONSTANT(NOTIFICATION_MOUSE_EXIT);
|
||||
BIND_CONSTANT(NOTIFICATION_MOUSE_ENTER_SELF);
|
||||
BIND_CONSTANT(NOTIFICATION_MOUSE_EXIT_SELF);
|
||||
BIND_CONSTANT(NOTIFICATION_FOCUS_ENTER);
|
||||
BIND_CONSTANT(NOTIFICATION_FOCUS_EXIT);
|
||||
BIND_CONSTANT(NOTIFICATION_THEME_CHANGED);
|
||||
|
||||
Reference in New Issue
Block a user