From 7b6530021fecd2cb8efa38e192de07c49fe7f04a Mon Sep 17 00:00:00 2001 From: Variable Date: Tue, 26 Nov 2024 16:48:05 +0500 Subject: [PATCH] If the color selected in the palette is the same then it should take prioity. --- src/Classes/ImageExtended.gd | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Classes/ImageExtended.gd b/src/Classes/ImageExtended.gd index b2eec5861..b3d8c8d59 100644 --- a/src/Classes/ImageExtended.gd +++ b/src/Classes/ImageExtended.gd @@ -147,13 +147,13 @@ func set_pixelv_custom(point: Vector2i, color: Color) -> void: if not color.is_equal_approx(TRANSPARENT): if palette.has(color): color_index = palette.find(color) - ## If the color selected in the palette is the same then it should take prioity. - #var selected_index = Palettes.current_palette_get_selected_color_index( - #Tools.active_button - #) - #if selected_index != -1: - #if Palettes.current_palette_get_color(selected_index) == color: - #color_index = selected_index + # If the color selected in the palette is the same then it should take prioity. + var selected_index = Palettes.current_palette_get_selected_color_index( + Tools.active_button + ) + if selected_index != -1: + if palette[selected_index].is_equal_approx(color): + color_index = selected_index else: # Find the most similar color var smaller_distance := color_distance(color, palette[0]) for i in palette.size():