@ -89,6 +89,25 @@ void TileMapEditor::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE : {
case NOTIFICATION_EXIT_TREE : {
get_tree ( ) - > disconnect ( " node_removed " , callable_mp ( this , & TileMapEditor : : _node_removed ) ) ;
get_tree ( ) - > disconnect ( " node_removed " , callable_mp ( this , & TileMapEditor : : _node_removed ) ) ;
} break ;
} break ;
case NOTIFICATION_APPLICATION_FOCUS_OUT : {
if ( tool = = TOOL_PAINTING ) {
Vector < int > ids = get_selected_tiles ( ) ;
if ( ids . size ( ) > 0 & & ids [ 0 ] ! = TileMap : : INVALID_CELL ) {
_set_cell ( over_tile , ids , flip_h , flip_v , transpose ) ;
_finish_undo ( ) ;
paint_undo . clear ( ) ;
}
tool = TOOL_NONE ;
_update_button_tool ( ) ;
}
// set flag to ignore over_tile on refocus
refocus_over_tile = true ;
} break ;
}
}
}
}
@ -1299,6 +1318,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
CanvasItemEditor : : get_singleton ( ) - > update_viewport ( ) ;
CanvasItemEditor : : get_singleton ( ) - > update_viewport ( ) ;
}
}
if ( refocus_over_tile ) {
// editor lost focus; forget last tile position
old_over_tile = new_over_tile ;
refocus_over_tile = false ;
}
int tile_under = node - > get_cell ( over_tile . x , over_tile . y ) ;
int tile_under = node - > get_cell ( over_tile . x , over_tile . y ) ;
String tile_name = " none " ;
String tile_name = " none " ;