mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Merge pull request #107955 from lodetrick/mouse-signals
Fix `mouse_entered` and `mouse_exited` Signals being emitted too early
This commit is contained in:
commit
f27f917d32
2 changed files with 4 additions and 8 deletions
|
@ -3901,14 +3901,6 @@ void Control::_notification(int p_notification) {
|
|||
RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), data.clip_contents);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_MOUSE_ENTER: {
|
||||
emit_signal(SceneStringName(mouse_entered));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_MOUSE_EXIT: {
|
||||
emit_signal(SceneStringName(mouse_exited));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_FOCUS_ENTER: {
|
||||
emit_signal(SceneStringName(focus_entered));
|
||||
queue_redraw();
|
||||
|
|
|
@ -2617,6 +2617,7 @@ void Viewport::_gui_update_mouse_over() {
|
|||
// Send Mouse Exit notifications.
|
||||
for (int exit_control_index : needs_exit) {
|
||||
gui.mouse_over_hierarchy[exit_control_index]->notification(Control::NOTIFICATION_MOUSE_EXIT);
|
||||
gui.mouse_over_hierarchy[exit_control_index]->emit_signal(SceneStringName(mouse_exited));
|
||||
}
|
||||
|
||||
// Update the mouse over hierarchy.
|
||||
|
@ -2628,6 +2629,7 @@ void Viewport::_gui_update_mouse_over() {
|
|||
// Send Mouse Enter notifications.
|
||||
for (int i = needs_enter.size() - 1; i >= 0; i--) {
|
||||
needs_enter[i]->notification(Control::NOTIFICATION_MOUSE_ENTER);
|
||||
needs_enter[i]->emit_signal(SceneStringName(mouse_entered));
|
||||
}
|
||||
|
||||
gui.sending_mouse_enter_exit_notifications = false;
|
||||
|
@ -3299,6 +3301,7 @@ void Viewport::_update_mouse_over(Vector2 p_pos) {
|
|||
for (int i = over_ancestors.size() - 1; i >= 0; i--) {
|
||||
gui.mouse_over_hierarchy.push_back(over_ancestors[i]);
|
||||
over_ancestors[i]->notification(Control::NOTIFICATION_MOUSE_ENTER);
|
||||
over_ancestors[i]->emit_signal(SceneStringName(mouse_entered));
|
||||
}
|
||||
|
||||
// Send Mouse Enter Self notification.
|
||||
|
@ -3390,6 +3393,7 @@ void Viewport::_drop_mouse_over(Control *p_until_control) {
|
|||
for (int i = gui.mouse_over_hierarchy.size() - 1; i >= notification_until; i--) {
|
||||
if (gui.mouse_over_hierarchy[i]->is_inside_tree()) {
|
||||
gui.mouse_over_hierarchy[i]->notification(Control::NOTIFICATION_MOUSE_EXIT);
|
||||
gui.mouse_over_hierarchy[i]->emit_signal(SceneStringName(mouse_exited));
|
||||
}
|
||||
}
|
||||
gui.mouse_over_hierarchy.resize(notification_until);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue