diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-11 12:35:24 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-11 12:35:24 +0200 |
commit | 8613f346e83c9cf39b81a92cee1c53019fbdca0b (patch) | |
tree | d69e8438ce140062d27a68f0cf25360b093d1732 | |
parent | 62717f2953a781258c56aa2eb6dffefc9dd53257 (diff) | |
parent | ab504b31395c2d49747a2d4f1da59258f30de983 (diff) | |
download | redot-engine-8613f346e83c9cf39b81a92cee1c53019fbdca0b.tar.gz |
Merge pull request #96844 from kleonc/tile_map_layer_fix_undoing_overlapping_move_tiles
Fix undoing "Move tiles" `TileMapLayer` action when drag/drop areas overlap
-rw-r--r-- | editor/plugins/tiles/tile_map_layer_editor.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp index 7e6746dd3c..dcfd92f6f9 100644 --- a/editor/plugins/tiles/tile_map_layer_editor.cpp +++ b/editor/plugins/tiles/tile_map_layer_editor.cpp @@ -1364,11 +1364,13 @@ void TileMapLayerEditorTilesPlugin::_stop_dragging() { Vector2i coords; HashMap<Vector2i, TileMapCell> cells_undo; for (int i = 0; i < selection_used_cells.size(); i++) { - coords = tile_set->map_pattern(top_left, selection_used_cells[i], selection_pattern); - cells_undo[coords] = TileMapCell(drag_modified[coords].source_id, drag_modified[coords].get_atlas_coords(), drag_modified[coords].alternative_tile); coords = tile_set->map_pattern(top_left + offset, selection_used_cells[i], selection_pattern); cells_undo[coords] = TileMapCell(edited_layer->get_cell_source_id(coords), edited_layer->get_cell_atlas_coords(coords), edited_layer->get_cell_alternative_tile(coords)); } + for (int i = 0; i < selection_used_cells.size(); i++) { + coords = tile_set->map_pattern(top_left, selection_used_cells[i], selection_pattern); + cells_undo[coords] = TileMapCell(drag_modified[coords].source_id, drag_modified[coords].get_atlas_coords(), drag_modified[coords].alternative_tile); + } // Build the list of cells to do. HashMap<Vector2i, TileMapCell> cells_do; |