From: Eduardo Fernandez Date: Sun, 24 Sep 2023 22:05:49 +0000 (+0200) Subject: set the hamburger with new styles and margins X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=7eb96be799c4a14709966baca3672006bf387c7a;p=The%20Cutests%20To-Do%20List.git set the hamburger with new styles and margins --- diff --git a/scenes/main_menu/MainMenu.tscn b/scenes/main_menu/MainMenu.tscn index 3a80247..7bb0554 100644 --- a/scenes/main_menu/MainMenu.tscn +++ b/scenes/main_menu/MainMenu.tscn @@ -25,7 +25,7 @@ grow_vertical = 2 mouse_filter = 2 script = ExtResource("1_yx80n") metadata/_edit_vertical_guides_ = [540.0, 62.0, 1020.0, 490.0, 590.0] -metadata/_edit_horizontal_guides_ = [940.0, 1340.0] +metadata/_edit_horizontal_guides_ = [940.0, 1340.0, 62.0] [node name="Background" type="ColorRect" parent="."] material = SubResource("ShaderMaterial_v5r1v") @@ -58,10 +58,10 @@ expand_mode = 2 stretch_mode = 5 [node name="Label" type="Label" parent="."] -layout_mode = 0 +layout_mode = 2 offset_left = 179.0 offset_top = 717.0 -offset_right = 250.0 +offset_right = 1138.0 offset_bottom = 837.0 theme_override_colors/font_color = Color(0, 0, 0, 1) text = " @@ -145,11 +145,11 @@ text = "Store" [node name="MenuButton" parent="." instance=ExtResource("5_qjr8j")] layout_mode = 1 -offset_left = 93.0 -offset_top = 131.0 -offset_right = 93.0 -offset_bottom = 131.0 -scale = Vector2(1.5, 1.5) +offset_left = 112.0 +offset_top = 103.0 +offset_right = 112.0 +offset_bottom = 103.0 +scale = Vector2(2, 2) [connection signal="pressed" from="VBoxContainer/VSplitContainer/BottomCenterContainer/ToDoBtn/Button" to="." method="_on_to_do_button_pressed"] [connection signal="pressed" from="VBoxContainer/VSplitContainer/BottomCenterContainer/CalendarBtn/Button" to="." method="_on_calendar_button_pressed"] diff --git a/themes/default/buttons/menu_button/MenuButton.gd b/themes/default/buttons/menu_button/MenuButton.gd index 165e9fd..c35be32 100644 --- a/themes/default/buttons/menu_button/MenuButton.gd +++ b/themes/default/buttons/menu_button/MenuButton.gd @@ -3,14 +3,17 @@ extends Control signal scene_changed(scene_name) @onready var buttons = [$Button2, $Link, $Settings] - @export var menu_opened = false -## Opens or closes the menu -func _on_button_pressed(): - menu_opened = !menu_opened - for b in buttons: - b.visible = menu_opened +func _on_container_gui_input(event): + if event is InputEventMouseButton: + if event.pressed == true: + toggle_menu() + + if event is InputEventScreenTouch: + if event.canceled == false: + toggle_menu() + func _on_link_pressed(): OS.shell_open("https://backpain.fun") @@ -18,5 +21,8 @@ func _on_link_pressed(): func _on_settings_pressed(): emit_signal("scene_changed", "res://scenes/settings/Settings.tscn") +## Opens or closes the menu func toggle_menu(): - _on_button_pressed() + menu_opened = !menu_opened + for b in buttons: + b.visible = menu_opened diff --git a/themes/default/buttons/menu_button/MenuButton.tscn b/themes/default/buttons/menu_button/MenuButton.tscn index f139430..1ca6184 100644 --- a/themes/default/buttons/menu_button/MenuButton.tscn +++ b/themes/default/buttons/menu_button/MenuButton.tscn @@ -3,10 +3,12 @@ [ext_resource type="Script" path="res://themes/default/buttons/menu_button/MenuButton.gd" id="1_xr3em"] [ext_resource type="Texture2D" uid="uid://gltlg33raqr6" path="res://themes/default/resources/vector_whiteIcons.svg" id="3_imhq0"] -[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_8ugr1"] -texture = ExtResource("3_imhq0") -region_rect = Rect2(604, 0, 36, 32) -modulate_color = Color(0, 0, 0, 1) +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kocyh"] +bg_color = Color(0.545098, 0.756863, 0.827451, 1) +corner_radius_top_left = 60 +corner_radius_top_right = 60 +corner_radius_bottom_right = 60 +corner_radius_bottom_left = 60 [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_phn6s"] texture = ExtResource("3_imhq0") @@ -28,13 +30,43 @@ layout_mode = 3 anchors_preset = 0 script = ExtResource("1_xr3em") -[node name="Button" type="Button" parent="."] -layout_mode = 0 -offset_left = -32.0 -offset_top = -32.0 -offset_right = 32.0 -offset_bottom = 32.0 -theme_override_styles/normal = SubResource("StyleBoxTexture_8ugr1") +[node name="Container" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -25.0 +offset_top = -25.0 +offset_right = 25.0 +offset_bottom = 25.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Panel" type="Panel" parent="Container"] +layout_mode = 2 +offset_top = 5.0 +offset_right = 50.0 +offset_bottom = 15.0 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_kocyh") + +[node name="Panel2" type="Panel" parent="Container"] +layout_mode = 2 +offset_top = 20.0 +offset_right = 50.0 +offset_bottom = 30.0 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_kocyh") + +[node name="Panel3" type="Panel" parent="Container"] +layout_mode = 2 +offset_top = 35.0 +offset_right = 50.0 +offset_bottom = 45.0 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_kocyh") [node name="Button2" type="Button" parent="."] visible = false @@ -63,6 +95,6 @@ offset_right = 24.0 offset_bottom = 256.0 theme_override_styles/normal = SubResource("StyleBoxTexture_jrhwr") -[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] +[connection signal="gui_input" from="Container" to="." method="_on_container_gui_input"] [connection signal="pressed" from="Link" to="." method="_on_link_pressed"] [connection signal="pressed" from="Settings" to="." method="_on_settings_pressed"]