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

Change the look of the mirror buttons

This commit is contained in:
Manolis Papadeas 2022-02-21 20:04:39 +02:00
parent 200d1c73a1
commit 4d3cb86800
6 changed files with 92 additions and 52 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 B

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 B

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

@ -1,15 +1,15 @@
extends BoxContainer
extends Container
onready var left_picker := $ColorPickersHorizontal/LeftColorPickerButton
onready var right_picker := $ColorPickersHorizontal/RightColorPickerButton
onready var left_picker := $VBoxContainer/ColorPickersHorizontal/LeftColorPickerButton
onready var right_picker := $VBoxContainer/ColorPickersHorizontal/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
$Mirror/Horizontal.pressed = Tools.horizontal_mirror
$Mirror/Vertical.pressed = Tools.vertical_mirror
$VBoxContainer/Mirror/Horizontal.pressed = Tools.horizontal_mirror
$VBoxContainer/Mirror/Vertical.pressed = Tools.vertical_mirror
func _on_ColorSwitch_pressed() -> void:
@ -51,6 +51,12 @@ func _on_Horizontal_toggled(button_pressed: bool) -> void:
and Global.show_guides
)
var texture_button: TextureRect = $VBoxContainer/Mirror/Horizontal/TextureRect
var file_name := "horizontal_mirror_on.png"
if !button_pressed:
file_name = "horizontal_mirror_off.png"
Global.change_button_texturerect(texture_button, file_name)
func _on_Vertical_toggled(button_pressed: bool) -> void:
Tools.vertical_mirror = button_pressed
@ -61,3 +67,9 @@ func _on_Vertical_toggled(button_pressed: bool) -> void:
Global.show_x_symmetry_axis
and Global.show_guides
)
var texture_button: TextureRect = $VBoxContainer/Mirror/Vertical/TextureRect
var file_name := "vertical_mirror_on.png"
if !button_pressed:
file_name = "vertical_mirror_off.png"
Global.change_button_texturerect(texture_button, file_name)

View file

@ -1,36 +1,38 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://assets/graphics/misc/color_defaults.png" type="Texture" id=1]
[ext_resource path="res://assets/graphics/misc/color_switch.png" type="Texture" id=2]
[ext_resource path="res://src/UI/ColorPickers.gd" type="Script" id=3]
[ext_resource path="res://assets/graphics/misc/horizontal_mirror_off.png" type="Texture" id=4]
[ext_resource path="res://assets/graphics/misc/vertical_mirror_on.png" type="Texture" id=5]
[ext_resource path="res://assets/graphics/misc/horizontal_mirror_on.png" type="Texture" id=6]
[ext_resource path="res://assets/graphics/misc/vertical_mirror_off.png" type="Texture" id=7]
[ext_resource path="res://assets/graphics/misc/vertical_mirror_off.png" type="Texture" id=4]
[ext_resource path="res://assets/graphics/misc/horizontal_mirror_off.png" type="Texture" id=5]
[sub_resource type="ShortCut" id=19]
[node name="ColorPickers" type="VBoxContainer"]
[node name="ColorPickers" type="PanelContainer"]
margin_left = 958.0
margin_top = 170.0
margin_right = 1276.0
margin_bottom = 229.062
custom_constants/separation = 13
alignment = 1
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorPickersHorizontal" type="HBoxContainer" parent="."]
margin_right = 318.0
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 7.0
margin_top = 7.0
margin_right = 311.0
margin_bottom = 75.0
[node name="ColorPickersHorizontal" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 304.0
margin_bottom = 32.0
custom_constants/separation = 13
alignment = 1
[node name="LeftColorPickerButton" type="ColorPickerButton" parent="ColorPickersHorizontal"]
margin_left = 69.0
margin_right = 133.0
[node name="LeftColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/ColorPickersHorizontal"]
margin_left = 62.0
margin_right = 126.0
margin_bottom = 32.0
rect_min_size = Vector2( 64, 32 )
hint_tooltip = "Choose a color for the left tool"
@ -38,13 +40,13 @@ mouse_default_cursor_shape = 2
size_flags_horizontal = 0
size_flags_vertical = 4
[node name="ColorButtonsVertical" type="VBoxContainer" parent="ColorPickersHorizontal"]
margin_left = 146.0
margin_right = 171.0
[node name="ColorButtonsVertical" type="VBoxContainer" parent="VBoxContainer/ColorPickersHorizontal"]
margin_left = 139.0
margin_right = 164.0
margin_bottom = 32.0
alignment = 1
[node name="ColorSwitch" type="TextureButton" parent="ColorPickersHorizontal/ColorButtonsVertical" groups=["UIButtons"]]
[node name="ColorSwitch" type="TextureButton" parent="VBoxContainer/ColorPickersHorizontal/ColorButtonsVertical" groups=["UIButtons"]]
margin_top = 6.0
margin_right = 25.0
margin_bottom = 13.0
@ -55,7 +57,7 @@ shortcut_in_tooltip = false
shortcut = SubResource( 19 )
texture_normal = ExtResource( 2 )
[node name="ColorDefaults" type="TextureButton" parent="ColorPickersHorizontal/ColorButtonsVertical"]
[node name="ColorDefaults" type="TextureButton" parent="VBoxContainer/ColorPickersHorizontal/ColorButtonsVertical"]
margin_top = 17.0
margin_right = 25.0
margin_bottom = 25.0
@ -63,9 +65,9 @@ hint_tooltip = "Reset the colors to their default state (black for left, white f
mouse_default_cursor_shape = 2
texture_normal = ExtResource( 1 )
[node name="RightColorPickerButton" type="ColorPickerButton" parent="ColorPickersHorizontal"]
margin_left = 184.0
margin_right = 248.0
[node name="RightColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/ColorPickersHorizontal"]
margin_left = 177.0
margin_right = 241.0
margin_bottom = 32.0
rect_min_size = Vector2( 64, 32 )
hint_tooltip = "Choose a color for the right tool"
@ -74,40 +76,66 @@ size_flags_horizontal = 0
size_flags_vertical = 4
color = Color( 1, 1, 1, 1 )
[node name="Mirror" type="HBoxContainer" parent="."]
margin_top = 45.0
margin_right = 318.0
margin_bottom = 62.0
[node name="Mirror" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 36.0
margin_right = 304.0
margin_bottom = 68.0
custom_constants/separation = 44
alignment = 1
[node name="Horizontal" type="TextureButton" parent="Mirror" groups=["UIButtons"]]
margin_left = 121.0
margin_right = 136.0
margin_bottom = 17.0
[node name="Horizontal" type="Button" parent="VBoxContainer/Mirror" groups=["UIButtons"]]
margin_left = 98.0
margin_right = 130.0
margin_bottom = 32.0
rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Enable horizontal mirrored drawing"
mouse_default_cursor_shape = 2
toggle_mode = true
texture_normal = ExtResource( 4 )
texture_pressed = ExtResource( 6 )
[node name="Vertical" type="TextureButton" parent="Mirror" groups=["UIButtons"]]
margin_left = 180.0
margin_right = 197.0
margin_bottom = 17.0
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Mirror/Horizontal"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -11.0
margin_top = -11.0
margin_right = 11.0
margin_bottom = 11.0
texture = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Vertical" type="Button" parent="VBoxContainer/Mirror" groups=["UIButtons"]]
margin_left = 174.0
margin_right = 206.0
margin_bottom = 32.0
rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Enable vertical mirrored drawing"
mouse_default_cursor_shape = 2
toggle_mode = true
texture_normal = ExtResource( 7 )
texture_pressed = ExtResource( 5 )
[connection signal="color_changed" from="ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_ColorPickerButton_color_changed" binds= [ false ]]
[connection signal="popup_closed" from="ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_ColorPickerButton_popup_closed"]
[connection signal="pressed" from="ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_ColorPickerButton_pressed"]
[connection signal="pressed" from="ColorPickersHorizontal/ColorButtonsVertical/ColorSwitch" to="." method="_on_ColorSwitch_pressed"]
[connection signal="pressed" from="ColorPickersHorizontal/ColorButtonsVertical/ColorDefaults" to="." method="_on_ColorDefaults_pressed"]
[connection signal="color_changed" from="ColorPickersHorizontal/RightColorPickerButton" to="." method="_on_ColorPickerButton_color_changed" binds= [ true ]]
[connection signal="popup_closed" from="ColorPickersHorizontal/RightColorPickerButton" to="." method="_on_ColorPickerButton_popup_closed"]
[connection signal="pressed" from="ColorPickersHorizontal/RightColorPickerButton" to="." method="_on_ColorPickerButton_pressed"]
[connection signal="toggled" from="Mirror/Horizontal" to="." method="_on_Horizontal_toggled"]
[connection signal="toggled" from="Mirror/Vertical" to="." method="_on_Vertical_toggled"]
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Mirror/Vertical"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -11.0
margin_top = -11.0
margin_right = 11.0
margin_bottom = 11.0
texture = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="color_changed" from="VBoxContainer/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_ColorPickerButton_color_changed" binds= [ false ]]
[connection signal="popup_closed" from="VBoxContainer/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_ColorPickerButton_popup_closed"]
[connection signal="pressed" from="VBoxContainer/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_ColorPickerButton_pressed"]
[connection signal="pressed" from="VBoxContainer/ColorPickersHorizontal/ColorButtonsVertical/ColorSwitch" to="." method="_on_ColorSwitch_pressed"]
[connection signal="pressed" from="VBoxContainer/ColorPickersHorizontal/ColorButtonsVertical/ColorDefaults" to="." method="_on_ColorDefaults_pressed"]
[connection signal="color_changed" from="VBoxContainer/ColorPickersHorizontal/RightColorPickerButton" to="." method="_on_ColorPickerButton_color_changed" binds= [ true ]]
[connection signal="popup_closed" from="VBoxContainer/ColorPickersHorizontal/RightColorPickerButton" to="." method="_on_ColorPickerButton_popup_closed"]
[connection signal="pressed" from="VBoxContainer/ColorPickersHorizontal/RightColorPickerButton" to="." method="_on_ColorPickerButton_pressed"]
[connection signal="toggled" from="VBoxContainer/Mirror/Horizontal" to="." method="_on_Horizontal_toggled"]
[connection signal="toggled" from="VBoxContainer/Mirror/Vertical" to="." method="_on_Vertical_toggled"]