1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Add tool button color & tool name header on each of the tool options

This commit is contained in:
Emmanouil Papadeas 2022-09-20 00:58:39 +03:00
parent 7a7b6739a9
commit 1f55ac92fd
8 changed files with 80 additions and 63 deletions

View file

@ -279,11 +279,13 @@ func preference_update(prop: String) -> void:
for child in Tools._tool_buttons.get_children():
var left_background: NinePatchRect = child.get_node("BackgroundLeft")
left_background.modulate = Global.left_tool_color
Tools._slots[BUTTON_LEFT].tool_node.color_rect.color = Global.left_tool_color
elif prop == "right_tool_color":
for child in Tools._tool_buttons.get_children():
var left_background: NinePatchRect = child.get_node("BackgroundRight")
left_background.modulate = Global.right_tool_color
Tools._slots[BUTTON_RIGHT].tool_node.color_rect.color = Global.right_tool_color
elif prop == "tool_button_size":
Tools.set_button_size(Global.tool_button_size)

View file

@ -5,16 +5,21 @@ var is_moving = false
var kname: String
var tool_slot = null # Tools.Slot, can't have static typing due to cyclic errors
var cursor_text := ""
var _cursor := Vector2.INF
var _draw_cache: PoolVector2Array = [] # for storing already drawn pixels
var _for_frame := 0 # cache for which frame?
onready var color_rect: ColorRect = $ColorRect
func _ready() -> void:
kname = name.replace(" ", "_").to_lower()
$Label.text = tool_slot.name
if tool_slot.name == "Left tool":
color_rect.color = Global.left_tool_color
else:
color_rect.color = Global.right_tool_color
$Label.text = Tools.tools[name].display_name
load_config()

View file

@ -10,9 +10,16 @@ margin_bottom = 65.0
size_flags_horizontal = 3
script = ExtResource( 1 )
[node name="Label" type="Label" parent="."]
[node name="ColorRect" type="ColorRect" parent="."]
margin_right = 116.0
margin_bottom = 14.0
margin_bottom = 4.0
rect_min_size = Vector2( 0, 4 )
[node name="Label" type="Label" parent="."]
margin_top = 8.0
margin_right = 116.0
margin_bottom = 22.0
theme_type_variation = "Header"
text = "Tool"
align = 1
autowrap = true

View file

@ -26,30 +26,33 @@ margin_right = 138.0
margin_bottom = 105.0
script = ExtResource( 3 )
[node name="Label" parent="." index="0"]
[node name="ColorRect" parent="." index="0"]
margin_right = 131.0
[node name="FillArea" type="Label" parent="." index="1"]
[node name="Label" parent="." index="1"]
margin_right = 131.0
[node name="FillArea" type="Label" parent="." index="2"]
margin_left = 38.0
margin_top = 18.0
margin_top = 26.0
margin_right = 92.0
margin_bottom = 32.0
margin_bottom = 40.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
text = "Fill area:"
[node name="FillAreaOptions" type="OptionButton" parent="." index="2"]
[node name="FillAreaOptions" type="OptionButton" parent="." index="3"]
margin_left = 13.0
margin_top = 36.0
margin_top = 44.0
margin_right = 117.0
margin_bottom = 56.0
margin_bottom = 64.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
text = "Similar area"
items = [ "Similar area", null, false, 0, null, "Similar colors", null, false, 1, null, "Whole selection", null, false, 2, null ]
selected = 0
[node name="Similarity" type="VBoxContainer" parent="." index="3"]
[node name="Similarity" type="VBoxContainer" parent="." index="4"]
visible = false
margin_top = 60.0
margin_right = 131.0
@ -97,26 +100,26 @@ __meta__ = {
"_editor_description_": ""
}
[node name="FillWith" type="Label" parent="." index="4"]
[node name="FillWith" type="Label" parent="." index="5"]
margin_left = 38.0
margin_top = 60.0
margin_top = 68.0
margin_right = 92.0
margin_bottom = 74.0
margin_bottom = 82.0
size_flags_horizontal = 4
text = "Fill with:"
[node name="FillWithOptions" type="OptionButton" parent="." index="5"]
[node name="FillWithOptions" type="OptionButton" parent="." index="6"]
margin_left = 5.0
margin_top = 78.0
margin_top = 86.0
margin_right = 126.0
margin_bottom = 98.0
margin_bottom = 106.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
text = "Selected Color"
items = [ "Selected Color", null, false, 0, null, "Pattern", null, false, 1, null ]
selected = 0
[node name="FillPattern" type="VBoxContainer" parent="." index="6"]
[node name="FillPattern" type="VBoxContainer" parent="." index="7"]
visible = false
margin_left = 22.0
margin_top = 102.0

View file

@ -6,10 +6,10 @@
[node name="ToolOptions" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="ColorPicker" type="VBoxContainer" parent="." index="1"]
margin_top = 18.0
[node name="ColorPicker" type="VBoxContainer" parent="." index="2"]
margin_top = 26.0
margin_right = 116.0
margin_bottom = 56.0
margin_bottom = 64.0
[node name="Label" type="Label" parent="ColorPicker" index="0"]
margin_left = 32.0

View file

@ -24,10 +24,10 @@ anti_aliasing = false
[node name="ToolOptions" instance=ExtResource( 2 )]
script = ExtResource( 3 )
[node name="Brush" type="HBoxContainer" parent="." index="1"]
margin_top = 18.0
[node name="Brush" type="HBoxContainer" parent="." index="2"]
margin_top = 26.0
margin_right = 116.0
margin_bottom = 50.0
margin_bottom = 58.0
alignment = 1
[node name="Type" type="Button" parent="Brush" index="0"]
@ -63,11 +63,11 @@ value = 1.0
align = 1
suffix = "px"
[node name="BrushSize" type="HSlider" parent="." index="2"]
[node name="BrushSize" type="HSlider" parent="." index="3"]
margin_left = 12.0
margin_top = 54.0
margin_top = 62.0
margin_right = 104.0
margin_bottom = 70.0
margin_bottom = 78.0
rect_min_size = Vector2( 92, 0 )
focus_mode = 0
mouse_default_cursor_shape = 2
@ -79,7 +79,7 @@ value = 1.0
allow_greater = true
ticks_on_borders = true
[node name="ColorInterpolation" type="VBoxContainer" parent="." index="3"]
[node name="ColorInterpolation" type="VBoxContainer" parent="." index="4"]
visible = false
margin_top = 102.0
margin_right = 116.0

View file

@ -6,18 +6,18 @@
[node name="ToolOptions" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="PositionLabel" type="Label" parent="." index="1"]
margin_top = 18.0
[node name="PositionLabel" type="Label" parent="." index="2"]
margin_top = 26.0
margin_right = 116.0
margin_bottom = 32.0
margin_bottom = 40.0
text = "Position:"
align = 1
[node name="XContainer" type="HBoxContainer" parent="." index="2"]
[node name="XContainer" type="HBoxContainer" parent="." index="3"]
margin_left = 10.0
margin_top = 36.0
margin_top = 44.0
margin_right = 105.0
margin_bottom = 60.0
margin_bottom = 68.0
size_flags_horizontal = 4
[node name="Label" type="Label" parent="XContainer" index="0"]
@ -36,11 +36,11 @@ mouse_default_cursor_shape = 2
allow_greater = true
allow_lesser = true
[node name="YContainer" type="HBoxContainer" parent="." index="3"]
[node name="YContainer" type="HBoxContainer" parent="." index="4"]
margin_left = 10.0
margin_top = 64.0
margin_top = 72.0
margin_right = 105.0
margin_bottom = 88.0
margin_bottom = 96.0
size_flags_horizontal = 4
[node name="Label" type="Label" parent="YContainer" index="0"]
@ -59,18 +59,18 @@ mouse_default_cursor_shape = 2
allow_greater = true
allow_lesser = true
[node name="SizeLabel" type="Label" parent="." index="4"]
margin_top = 92.0
[node name="SizeLabel" type="Label" parent="." index="5"]
margin_top = 100.0
margin_right = 116.0
margin_bottom = 106.0
margin_bottom = 114.0
text = "Size:"
align = 1
[node name="WidthContainer" type="HBoxContainer" parent="." index="5"]
[node name="WidthContainer" type="HBoxContainer" parent="." index="6"]
margin_left = 10.0
margin_top = 110.0
margin_top = 118.0
margin_right = 105.0
margin_bottom = 134.0
margin_bottom = 142.0
size_flags_horizontal = 4
[node name="Label" type="Label" parent="WidthContainer" index="0"]
@ -90,11 +90,11 @@ min_value = 1.0
value = 1.0
allow_greater = true
[node name="HeightContainer" type="HBoxContainer" parent="." index="6"]
[node name="HeightContainer" type="HBoxContainer" parent="." index="7"]
margin_left = 10.0
margin_top = 138.0
margin_top = 146.0
margin_right = 105.0
margin_bottom = 162.0
margin_bottom = 170.0
size_flags_horizontal = 4
[node name="Label" type="Label" parent="HeightContainer" index="0"]
@ -114,7 +114,7 @@ min_value = 1.0
value = 1.0
allow_greater = true
[node name="Timer" type="Timer" parent="." index="7"]
[node name="Timer" type="Timer" parent="." index="8"]
wait_time = 0.2
one_shot = true

View file

@ -6,20 +6,20 @@
[node name="ToolOptions" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="Mode" type="Label" parent="." index="1"]
[node name="Mode" type="Label" parent="." index="2"]
margin_left = 38.0
margin_top = 18.0
margin_top = 26.0
margin_right = 78.0
margin_bottom = 32.0
margin_bottom = 40.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
text = "Mode:"
[node name="ModeOptions" type="OptionButton" parent="." index="2"]
[node name="ModeOptions" type="OptionButton" parent="." index="3"]
margin_left = 12.0
margin_top = 36.0
margin_top = 44.0
margin_right = 104.0
margin_bottom = 56.0
margin_bottom = 64.0
rect_min_size = Vector2( 92, 0 )
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
@ -27,30 +27,30 @@ text = "Zoom in"
items = [ "Zoom in", null, false, 0, null, "Zoom out", null, false, 1, null ]
selected = 0
[node name="Options" type="Label" parent="." index="3"]
[node name="Options" type="Label" parent="." index="4"]
margin_left = 30.0
margin_top = 60.0
margin_top = 68.0
margin_right = 85.0
margin_bottom = 74.0
margin_bottom = 82.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
text = "Options:"
[node name="FitToFrame" type="Button" parent="." index="4"]
[node name="FitToFrame" type="Button" parent="." index="5"]
margin_left = 12.0
margin_top = 78.0
margin_top = 86.0
margin_right = 104.0
margin_bottom = 98.0
margin_bottom = 106.0
rect_min_size = Vector2( 92, 0 )
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
text = "Fit to frame"
[node name="100%" type="Button" parent="." index="5"]
[node name="100%" type="Button" parent="." index="6"]
margin_left = 12.0
margin_top = 102.0
margin_top = 110.0
margin_right = 104.0
margin_bottom = 122.0
margin_bottom = 130.0
rect_min_size = Vector2( 92, 0 )
mouse_default_cursor_shape = 2
size_flags_horizontal = 4