Skip to content

Commit 3f2245c

Browse files
Fix color picker changing hue when modifying the saturation and value inside the color picker shape
1 parent 89de8ab commit 3f2245c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/UI/ColorPickers/ColorPicker.gd

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var shape_aspect_ratio: AspectRatioContainer
1212
var swatches_button: Button
1313
## The internal container for the color sliders of the [ColorPicker] node.
1414
var color_sliders_vbox: VBoxContainer
15+
var _skip_color_picker_update := false
1516
@onready var color_picker := %ColorPicker as ColorPicker
1617
@onready var color_buttons := %ColorButtons as HBoxContainer
1718
@onready var left_color_rect := %LeftColorRect as ColorRect
@@ -105,10 +106,7 @@ func _on_color_picker_color_changed(color: Color) -> void:
105106
# So we're using this trick to convert the values back to how they are shown in
106107
# the color picker's UI.
107108
color = Color(color.to_html())
108-
if Tools.picking_color_for == MOUSE_BUTTON_RIGHT:
109-
right_color_rect.color = color
110-
else:
111-
left_color_rect.color = color
109+
_skip_color_picker_update = true
112110
Tools.assign_color(color, Tools.picking_color_for)
113111

114112

@@ -130,7 +128,7 @@ func reset_options() -> void:
130128

131129
func update_color(color_info: Dictionary, button: int) -> void:
132130
var color = color_info.get("color", Color.WHITE)
133-
if Tools.picking_color_for == button:
131+
if Tools.picking_color_for == button and not _skip_color_picker_update:
134132
color_picker.color = color
135133
if button == MOUSE_BUTTON_RIGHT:
136134
right_color_rect.color = color
@@ -139,6 +137,7 @@ func update_color(color_info: Dictionary, button: int) -> void:
139137
_average(left_color_rect.color, right_color_rect.color)
140138
Global.config_cache.set_value("color_picker", "color_mode", color_picker.color_mode)
141139
Global.config_cache.set_value("color_picker", "picker_shape", color_picker.picker_shape)
140+
_skip_color_picker_update = false
142141

143142

144143
func _on_ColorSwitch_pressed() -> void:

0 commit comments

Comments
 (0)