Skip to content

Commit 356c80a

Browse files
Fix color picker acting weird when the alpha of the color is set to 0
1 parent 39eaf43 commit 356c80a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: src/UI/ColorPickers/ColorPicker.gd

+9-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,15 @@ func _on_color_picker_color_changed(color: Color) -> void:
109109
# the color picker's UI.
110110
color = Color(color.to_html())
111111
_skip_color_picker_update = true
112-
Tools.assign_color(color, Tools.picking_color_for)
112+
# This was requested by Issue #54 on GitHub
113+
# Do it here instead of in Tools.assign_color in order to ensure that the
114+
# color picker's color value changes.
115+
var c: Color = Tools._slots[Tools.picking_color_for].color
116+
if color.a == 0:
117+
if color.r != c.r or color.g != c.g or color.b != c.b:
118+
color.a = 1
119+
color_picker.color.a = 1
120+
Tools.assign_color(color, Tools.picking_color_for, false)
113121

114122

115123
func _on_left_color_button_toggled(toggled_on: bool) -> void:

0 commit comments

Comments
 (0)