From cf1530d338614b9c9301b5f30c016921dcc003f6 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Mon, 11 May 2020 01:46:24 +0300 Subject: [PATCH] Fixed issue with color picker tool, picking the wrong color value The color picker was picking color values left over from an undo operation. Meaning, if you drew something and then undid it, the color picker would pick the color before the undo. --- src/Canvas.gd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Canvas.gd b/src/Canvas.gd index 0ab687198..29f7c43b8 100644 --- a/src/Canvas.gd +++ b/src/Canvas.gd @@ -458,7 +458,10 @@ func _input(event : InputEvent) -> void: Global.selection_rectangle.polygon[3] = Vector2(start_pos.x, end_pos.y) "ColorPicker": if can_handle: - var pixel_color : Color = sprite.get_pixelv(mouse_pos) + var image_data := Image.new() + image_data.copy_from(sprite) + image_data.lock() + var pixel_color : Color = image_data.get_pixelv(mouse_pos) if color_picker_for == 0: # Pick for the left color Global.left_color_picker.color = pixel_color Global.update_left_custom_brush()