From 3022963b84cb67c57b7031d8c9357ebe83f6734c Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Mon, 9 Dec 2024 00:17:43 +0200 Subject: [PATCH] Fix pasting not being snapped to grid when draw tiles mode is enabled --- src/UI/Canvas/Selection.gd | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/UI/Canvas/Selection.gd b/src/UI/Canvas/Selection.gd index 97fbec396..1df960651 100644 --- a/src/UI/Canvas/Selection.gd +++ b/src/UI/Canvas/Selection.gd @@ -823,8 +823,23 @@ func paste(in_place := false) -> void: else: camera_center.y = 0 big_bounding_rectangle.position = Vector2i(camera_center.floor()) + if Tools.is_placing_tiles(): + var tileset := (Global.current_project.get_current_cel() as CelTileMap).tileset + var grid_size := tileset.tile_size + big_bounding_rectangle.position = Vector2i( + Tools.snap_to_rectangular_grid_boundary(big_bounding_rectangle.position, grid_size) + ) project.selection_map.move_bitmap_values(Global.current_project, false) - + else: + if Tools.is_placing_tiles(): + var tileset := (Global.current_project.get_current_cel() as CelTileMap).tileset + var grid_size := tileset.tile_size + project.selection_offset = Tools.snap_to_rectangular_grid_boundary( + project.selection_offset, grid_size + ) + big_bounding_rectangle.position = Vector2i( + Tools.snap_to_rectangular_grid_boundary(big_bounding_rectangle.position, grid_size) + ) big_bounding_rectangle = big_bounding_rectangle temp_rect = big_bounding_rectangle is_moving_content = true