1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Fix pasting not being snapped to grid when draw tiles mode is enabled

This commit is contained in:
Emmanouil Papadeas 2024-12-09 00:17:43 +02:00
parent 0873a7bf70
commit 3022963b84

View file

@ -823,8 +823,23 @@ func paste(in_place := false) -> void:
else: else:
camera_center.y = 0 camera_center.y = 0
big_bounding_rectangle.position = Vector2i(camera_center.floor()) 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) 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 big_bounding_rectangle = big_bounding_rectangle
temp_rect = big_bounding_rectangle temp_rect = big_bounding_rectangle
is_moving_content = true is_moving_content = true