Skip to content

Commit ebfa234

Browse files
Ready for alpha 2 release (#23)
1 parent c7cc211 commit ebfa234

File tree

8 files changed

+43
-30
lines changed

8 files changed

+43
-30
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
# Used in the editor config file name. Do not change this for patch releases.
1616
GODOT_FEATURE_VERSION: 4.4
1717
# Commit hash
18-
GODOT_COMMIT_HASH: daa4b058ee9272dd4ee9033bb093afb21ad558b7
18+
GODOT_COMMIT_HASH: 49a5bc7b6
1919
PROJECT_NAME: GodSVG Mobile
2020
BUILD_OPTIONS: target=template_release lto=full production=yes deprecated=no minizip=no brotli=no vulkan=no openxr=no use_volk=no disable_3d=yes modules_enabled_by_default=no module_freetype_enabled=yes module_gdscript_enabled=yes module_svg_enabled=yes module_jpg_enabled=yes module_text_server_adv_enabled=yes graphite=no module_webp_enabled=yes module_mbedtls_enabled=yes swappy=no build_profile=../godsvg/.github/disabled_classes.build
2121
GODOT_REPO: https://github.com/godotengine/godot.git

src/config_classes/SaveData.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ func remove_tab(idx: int) -> void:
711711
if idx < _active_tab_index:
712712
new_active_tab_index -= 1
713713

714-
# Clear unnecessary files.
714+
# Clear unnecessary files. This will clear the removed tab too.
715715
var used_file_paths := PackedStringArray()
716716
for tab in _tabs:
717717
used_file_paths.append(tab.get_edited_file_path())
@@ -720,7 +720,7 @@ func remove_tab(idx: int) -> void:
720720
for file_name in DirAccess.get_files_at(TabData.EDITED_FILES_DIR):
721721
var full_path := TabData.EDITED_FILES_DIR.path_join(file_name)
722722
if not full_path in used_file_paths:
723-
DirAccess.remove_absolute(TabData.EDITED_FILES_DIR.path_join(file_name))
723+
DirAccess.remove_absolute(full_path)
724724

725725
if _tabs.is_empty():
726726
_add_new_tab()

src/ui_parts/handles_manager.gd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ func _ready() -> void:
9595
State.hover_changed.connect(queue_redraw)
9696
State.zoom_changed.connect(queue_redraw)
9797
State.handle_added.connect(_on_handle_added)
98-
State.show_handles_changed.connect(toggle_visibility)
9998
State.view_changed.connect(_on_view_changed)
10099
queue_update_handles()
100+
101+
State.show_handles_changed.connect(update_show_handles)
102+
update_show_handles()
101103

102104

103-
func toggle_visibility() -> void:
104-
visible = not visible
105+
func update_show_handles() -> void:
106+
visible = State.show_handles
105107
HandlerGUI.throw_mouse_motion_event()
106108

107109
func queue_update_handles() -> void:

src/ui_parts/tab_bar.gd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,21 +412,21 @@ func _get_tooltip(at_position: Vector2) -> String:
412412

413413
return ""
414414

415-
var current_tab := Configs.savedata.get_tab(hovered_tab_idx)
415+
var hovered_tab := Configs.savedata.get_tab(hovered_tab_idx)
416416
# We have to pass some metadata to the tooltip.
417417
# Since "*" isn't valid in filepaths, we use it as a delimiter.
418418
if hovered_tab_idx == Configs.savedata.get_active_tab_index():
419-
return "%s*active" % current_tab.get_presented_svg_file_path()
419+
return "%s*active" % hovered_tab.get_presented_svg_file_path()
420420

421-
return "%s*%d" % [current_tab.get_presented_svg_file_path(), current_tab.id]
421+
return "%s*%d" % [hovered_tab.get_presented_svg_file_path(), hovered_tab.id]
422422

423423
func _make_custom_tooltip(for_text: String) -> Object:
424424
var asterisk_pos := for_text.find("*")
425425
if asterisk_pos == -1:
426426
return null
427427

428-
var current_tab := Configs.savedata.get_tab(get_hovered_index())
429-
var is_saved := not current_tab.svg_file_path.is_empty()
428+
var hovered_tab := Configs.savedata.get_tab(get_hovered_index())
429+
var is_saved := not hovered_tab.svg_file_path.is_empty()
430430

431431
var path := for_text.left(asterisk_pos)
432432
var label := Label.new()
@@ -438,9 +438,9 @@ func _make_custom_tooltip(for_text: String) -> Object:
438438
Translator.translate("This SVG is not bound to a file location yet.")
439439
Utils.set_max_text_width(label, 192.0, 4.0)
440440

441-
# If the tab is active, no need for an SVG preview.
441+
# If the tab is active or empty, no need for an SVG preview.
442442
var metadata := for_text.right(-asterisk_pos - 1)
443-
if metadata == "active":
443+
if metadata == "active" or hovered_tab.empty_unsaved:
444444
return label
445445

446446
var id := metadata.to_int()

src/ui_widgets/camera.gd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@ func _ready() -> void:
2525
State.svg_resized.connect(queue_redraw)
2626
State.zoom_changed.connect(change_zoom)
2727
State.zoom_changed.connect(queue_redraw)
28-
State.show_grid_changed.connect(toggle_visibility)
28+
29+
State.show_grid_changed.connect(update_show_grid)
30+
update_show_grid()
2931

3032
func exit_tree() -> void:
3133
RenderingServer.free_rid(surface)
3234

3335
func change_zoom() -> void:
3436
zoom = State.zoom
3537

36-
func toggle_visibility() -> void:
37-
visible = not visible
38+
func update_show_grid() -> void:
39+
visible = State.show_grid
3840

3941

4042
func update() -> void:

src/ui_widgets/points_field.tscn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
[ext_resource type="Script" uid="uid://1hox6gd5pxku" path="res://src/ui_widgets/BetterLineEdit.gd" id="2_4uivs"]
55

66
[node name="PointsField" type="VBoxContainer"]
7-
offset_right = 358.0
7+
offset_right = 300.0
88
offset_bottom = 45.0
99
theme_override_constants/separation = 2
1010
script = ExtResource("1_pnk5w")
1111

1212
[node name="LineEdit" type="LineEdit" parent="."]
13-
custom_minimum_size = Vector2(358, 0)
13+
custom_minimum_size = Vector2(300, 0)
1414
layout_mode = 2
1515
size_flags_horizontal = 0
1616
focus_mode = 1
1717
script = ExtResource("2_4uivs")
1818
mono_font_tooltip = true
1919

2020
[node name="Points" type="Control" parent="."]
21-
custom_minimum_size = Vector2(344, 0)
21+
custom_minimum_size = Vector2(295, 0)
2222
layout_mode = 2
2323
size_flags_horizontal = 8

src/ui_widgets/zoom_menu.gd

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const MAX_ZOOM = 512.0
66
signal zoom_changed(zoom_level: float, offset: Vector2)
77
signal zoom_reset_pressed
88

9-
@onready var zoom_out_button: BetterButton = $ZoomOut
10-
@onready var zoom_in_button: BetterButton = $ZoomIn
11-
@onready var zoom_reset_button: BetterButton = $ZoomReset
9+
@onready var zoom_out_button: Button = $ZoomOut
10+
@onready var zoom_in_button: Button = $ZoomIn
11+
@onready var zoom_reset_button: Button = $ZoomReset
1212

1313
var _zoom_level: float
1414

@@ -71,3 +71,15 @@ func update_buttons_appearance() -> void:
7171
zoom_out_button.disabled = is_min_zoom
7272
zoom_out_button.mouse_default_cursor_shape = Control.CURSOR_ARROW if\
7373
is_min_zoom else Control.CURSOR_POINTING_HAND
74+
75+
76+
func _on_zoom_out_pressed() -> void:
77+
HandlerGUI.throw_action_event("zoom_out")
78+
79+
80+
func _on_zoom_reset_pressed() -> void:
81+
HandlerGUI.throw_action_event("zoom_reset")
82+
83+
84+
func _on_zoom_in_pressed() -> void:
85+
HandlerGUI.throw_action_event("zoom_in")

src/ui_widgets/zoom_menu.tscn

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
[gd_scene load_steps=5 format=3 uid="uid://oltvrf01xrxl"]
1+
[gd_scene load_steps=4 format=3 uid="uid://oltvrf01xrxl"]
22

33
[ext_resource type="Texture2D" uid="uid://c2h5snkvemm4p" path="res://assets/icons/Minus.svg" id="1_8ggy2"]
44
[ext_resource type="Script" uid="uid://dj2q7wnto3uqp" path="res://src/ui_widgets/zoom_menu.gd" id="1_18ab8"]
55
[ext_resource type="Texture2D" uid="uid://eif2ioi0mw17" path="res://assets/icons/Plus.svg" id="2_284x5"]
6-
[ext_resource type="Script" uid="uid://ynx3s1jc6bwq" path="res://src/ui_widgets/BetterButton.gd" id="3_vgfv3"]
76

87
[node name="ZoomMenu" type="HBoxContainer"]
98
offset_right = 114.0
@@ -18,17 +17,13 @@ mouse_default_cursor_shape = 2
1817
theme_type_variation = &"IconButton"
1918
icon = ExtResource("1_8ggy2")
2019
icon_alignment = 1
21-
script = ExtResource("3_vgfv3")
22-
action = "zoom_out"
2320

2421
[node name="ZoomReset" type="Button" parent="."]
2522
custom_minimum_size = Vector2(58, 0)
2623
layout_mode = 2
2724
focus_mode = 0
2825
mouse_default_cursor_shape = 2
2926
text = "100%"
30-
script = ExtResource("3_vgfv3")
31-
action = "zoom_reset"
3227

3328
[node name="ZoomIn" type="Button" parent="."]
3429
layout_mode = 2
@@ -37,5 +32,7 @@ mouse_default_cursor_shape = 2
3732
theme_type_variation = &"IconButton"
3833
icon = ExtResource("2_284x5")
3934
icon_alignment = 1
40-
script = ExtResource("3_vgfv3")
41-
action = "zoom_in"
35+
36+
[connection signal="pressed" from="ZoomOut" to="." method="_on_zoom_out_pressed"]
37+
[connection signal="pressed" from="ZoomReset" to="." method="_on_zoom_reset_pressed"]
38+
[connection signal="pressed" from="ZoomIn" to="." method="_on_zoom_in_pressed"]

0 commit comments

Comments
 (0)