From f10c89ace5bc182e85bd8901ce63f55a41fdd768 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Sat, 25 Nov 2023 00:32:05 +0200 Subject: [PATCH] Fix not being able to transform if the selection size is bigger than the project size --- src/UI/Canvas/Selection.gd | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/UI/Canvas/Selection.gd b/src/UI/Canvas/Selection.gd index 929dbe399..510f62957 100644 --- a/src/UI/Canvas/Selection.gd +++ b/src/UI/Canvas/Selection.gd @@ -908,8 +908,12 @@ func _get_preview_image() -> void: original_preview_image.create( big_bounding_rectangle.size.x, big_bounding_rectangle.size.y, false, Image.FORMAT_RGBA8 ) + var selection_map_copy := SelectionMap.new() + selection_map_copy.copy_from(project.selection_map) + # In case the selection map is bigger than the canvas + selection_map_copy.crop(project.size.x, project.size.y) original_preview_image.blit_rect_mask( - blended_image, project.selection_map, big_bounding_rectangle, Vector2.ZERO + blended_image, selection_map_copy, big_bounding_rectangle, Vector2.ZERO ) if original_preview_image.is_invisible(): original_preview_image = Image.new() @@ -944,5 +948,9 @@ func _get_selected_image(cel_image: Image) -> Image: image.create( big_bounding_rectangle.size.x, big_bounding_rectangle.size.y, false, Image.FORMAT_RGBA8 ) - image.blit_rect_mask(cel_image, project.selection_map, big_bounding_rectangle, Vector2.ZERO) + var selection_map_copy := SelectionMap.new() + selection_map_copy.copy_from(project.selection_map) + # In case the selection map is bigger than the canvas + selection_map_copy.crop(project.size.x, project.size.y) + image.blit_rect_mask(cel_image, selection_map_copy, big_bounding_rectangle, Vector2.ZERO) return image