From 83d9800fc1fed6c8441d08f0eb0a2cda16a1cadc Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Fri, 23 Apr 2021 19:18:41 +0300 Subject: [PATCH] Fix selection being moved by one pixel when being resized & temp_rect has negative size --- src/UI/Canvas/Selection.gd | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/UI/Canvas/Selection.gd b/src/UI/Canvas/Selection.gd index 68a514978..882fb1c52 100644 --- a/src/UI/Canvas/Selection.gd +++ b/src/UI/Canvas/Selection.gd @@ -204,7 +204,14 @@ func gizmo_resize() -> void: temp_rect = temp_rect.grow_individual(left, top, right, bottom) big_bounding_rectangle = temp_rect.abs() big_bounding_rectangle.position = big_bounding_rectangle.position.ceil() - self.big_bounding_rectangle.size = big_bounding_rectangle.size.ceil() + big_bounding_rectangle.size = big_bounding_rectangle.size.floor() + if big_bounding_rectangle.size.x == 0: + big_bounding_rectangle.size.x = 1 + if big_bounding_rectangle.size.y == 0: + big_bounding_rectangle.size.y = 1 + + self.big_bounding_rectangle = big_bounding_rectangle # Call the setter method + var size = big_bounding_rectangle.size.abs() preview_image.copy_from(original_preview_image) preview_image.resize(size.x, size.y, Image.INTERPOLATE_NEAREST)