1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 09:39:48 +00:00
Pixelorama/src/UI/ColorPickers.gd
Manolis Papadeas e2bb0b8440
New UI system using Dockable Containers (#640)
* Add dockable container plugin

Experimenting with it, also added a tabs_visible property to the DockableContainer. Removed some code about Tallscreen from Main.gd, but not all of it.

* Add a panel behind the UI, temporarily restore the dark theme

* Remove tallscreen code

* Add edit mode, toggles DockableContainer's tab visibility on and off

* Split tool options into color pickers, left and right tool options

* Remove alternate_transparent_background

* Re-order tool buttons on resize

* Clip content in timeline

* Changes to the tool panel

* Removed some old unused node variables

* Restore Zen mode

* Set tabs_visible = false by default

* Better way to set tabs_visible = false by default

* Added the license of godot-dockable-container

* Remove unneeded lines

* Update README.md

* Restore window transparency with the canvas

It makes all of the TabContainers transparent however, which may not be what we actually want.

* Change tab names of the UI elements

* Remove unneeded nodes from ColorPickers.tscn

* Update default.tres

* Let the user hide elements individually

* Add some checks in HandleThemes

* Center tool icons

* Remove unneeded custom panel in SplashDialog

* Bump version to v0.10-dev and some other minor changes

* Fix crash on Zen Mode

* Added a hacky way to fix the issue with the palette panel size
2022-01-30 00:47:25 +02:00

41 lines
1,002 B
GDScript

extends HBoxContainer
onready var left_picker := $LeftColorPickerButton
onready var right_picker := $RightColorPickerButton
func _ready() -> void:
Tools.connect("color_changed", self, "update_color")
left_picker.get_picker().presets_visible = false
right_picker.get_picker().presets_visible = false
func _on_ColorSwitch_pressed() -> void:
Tools.swap_color()
func _on_ColorPickerButton_color_changed(color: Color, right: bool):
var button := BUTTON_RIGHT if right else BUTTON_LEFT
Tools.assign_color(color, button)
func _on_ColorPickerButton_pressed() -> void:
Global.can_draw = false
Tools.disconnect("color_changed", self, "update_color")
func _on_ColorPickerButton_popup_closed() -> void:
Global.can_draw = true
Tools.connect("color_changed", self, "update_color")
func _on_ColorDefaults_pressed() -> void:
Tools.default_color()
func update_color(color: Color, button: int) -> void:
if button == BUTTON_LEFT:
left_picker.color = color
else:
right_picker.color = color