diff --git a/editor/scene/2d/tiles/tile_map_layer_editor.cpp b/editor/scene/2d/tiles/tile_map_layer_editor.cpp index f8e19534c8..00ef364838 100644 --- a/editor/scene/2d/tiles/tile_map_layer_editor.cpp +++ b/editor/scene/2d/tiles/tile_map_layer_editor.cpp @@ -3742,6 +3742,14 @@ void TileMapLayerEditor::_notification(int p_what) { toggle_highlight_selected_layer_button->set_pressed_no_signal(EDITOR_GET("editors/tiles_editor/highlight_selected_layer")); } } break; + + case NOTIFICATION_APPLICATION_FOCUS_OUT: { + // Simulate mouse released event to stop drawing when editor focus exits. + Ref release; + release.instantiate(); + release->set_button_index(MouseButton::LEFT); + forward_canvas_gui_input(release); + } break; } } diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index d439799bc3..f8c8f7f9f0 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -1334,8 +1334,8 @@ void GridMapEditor::_notification(int p_what) { } break; case NOTIFICATION_APPLICATION_FOCUS_OUT: { - if (input_action == INPUT_PAINT) { - // Simulate mouse released event to stop drawing when editor focus exists. + if (input_action == INPUT_PAINT || input_action == INPUT_ERASE || input_action == INPUT_SELECT) { + // Simulate mouse released event to stop drawing when editor focus exits. Ref release; release.instantiate(); release->set_button_index(MouseButton::LEFT);