2020-05-19 00:51:16 +00:00
|
|
|
extends VBoxContainer
|
|
|
|
|
2021-08-16 23:56:19 +00:00
|
|
|
onready var left_picker := $ColorPickersHorizontal/LeftColorPickerButton
|
|
|
|
onready var right_picker := $ColorPickersHorizontal/RightColorPickerButton
|
2020-07-09 12:22:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
Tools.connect("color_changed", self, "update_color")
|
|
|
|
left_picker.get_picker().presets_visible = false
|
|
|
|
right_picker.get_picker().presets_visible = false
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorSwitch_pressed() -> void:
|
2020-07-09 12:22:17 +00:00
|
|
|
Tools.swap_color()
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_ColorPickerButton_color_changed(color: Color, right: bool):
|
2020-07-09 12:22:17 +00:00
|
|
|
var button := BUTTON_RIGHT if right else BUTTON_LEFT
|
|
|
|
Tools.assign_color(color, button)
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorPickerButton_pressed() -> void:
|
|
|
|
Global.can_draw = false
|
2021-04-01 23:13:54 +00:00
|
|
|
Tools.disconnect("color_changed", self, "update_color")
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorPickerButton_popup_closed() -> void:
|
|
|
|
Global.can_draw = true
|
2021-04-01 23:13:54 +00:00
|
|
|
Tools.connect("color_changed", self, "update_color")
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorDefaults_pressed() -> void:
|
2020-07-09 12:22:17 +00:00
|
|
|
Tools.default_color()
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func update_color(color: Color, button: int) -> void:
|
2020-07-09 12:22:17 +00:00
|
|
|
if button == BUTTON_LEFT:
|
|
|
|
left_picker.color = color
|
2020-05-19 00:51:16 +00:00
|
|
|
else:
|
2020-07-09 12:22:17 +00:00
|
|
|
right_picker.color = color
|