Skip to content

Commit

Permalink
Merge pull request godotengine#96844 from kleonc/tile_map_layer_fix_u…
Browse files Browse the repository at this point in the history
…ndoing_overlapping_move_tiles

Fix undoing "Move tiles" `TileMapLayer` action when drag/drop areas overlap
  • Loading branch information
akien-mga committed Sep 11, 2024
2 parents 62717f2 + ab504b3 commit 8613f34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions editor/plugins/tiles/tile_map_layer_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8613f34

Please sign in to comment.