Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
# Used in the editor config file name. Do not change this for patch releases.
GODOT_FEATURE_VERSION: 4.4
# Commit hash
GODOT_COMMIT_HASH: daa4b058ee9272dd4ee9033bb093afb21ad558b7
GODOT_COMMIT_HASH: 49a5bc7b6
PROJECT_NAME: GodSVG Mobile
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
GODOT_REPO: https://github.com/godotengine/godot.git
Expand Down
4 changes: 2 additions & 2 deletions src/config_classes/SaveData.gd
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ func remove_tab(idx: int) -> void:
if idx < _active_tab_index:
new_active_tab_index -= 1

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

if _tabs.is_empty():
_add_new_tab()
Expand Down
8 changes: 5 additions & 3 deletions src/ui_parts/handles_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ func _ready() -> void:
State.hover_changed.connect(queue_redraw)
State.zoom_changed.connect(queue_redraw)
State.handle_added.connect(_on_handle_added)
State.show_handles_changed.connect(toggle_visibility)
State.view_changed.connect(_on_view_changed)
queue_update_handles()

State.show_handles_changed.connect(update_show_handles)
update_show_handles()


func toggle_visibility() -> void:
visible = not visible
func update_show_handles() -> void:
visible = State.show_handles
HandlerGUI.throw_mouse_motion_event()

func queue_update_handles() -> void:
Expand Down
14 changes: 7 additions & 7 deletions src/ui_parts/tab_bar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -412,21 +412,21 @@ func _get_tooltip(at_position: Vector2) -> String:

return ""

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

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

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

var current_tab := Configs.savedata.get_tab(get_hovered_index())
var is_saved := not current_tab.svg_file_path.is_empty()
var hovered_tab := Configs.savedata.get_tab(get_hovered_index())
var is_saved := not hovered_tab.svg_file_path.is_empty()

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

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

var id := metadata.to_int()
Expand Down
8 changes: 5 additions & 3 deletions src/ui_widgets/camera.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ func _ready() -> void:
State.svg_resized.connect(queue_redraw)
State.zoom_changed.connect(change_zoom)
State.zoom_changed.connect(queue_redraw)
State.show_grid_changed.connect(toggle_visibility)

State.show_grid_changed.connect(update_show_grid)
update_show_grid()

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

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

func toggle_visibility() -> void:
visible = not visible
func update_show_grid() -> void:
visible = State.show_grid


func update() -> void:
Expand Down
6 changes: 3 additions & 3 deletions src/ui_widgets/points_field.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
[ext_resource type="Script" uid="uid://1hox6gd5pxku" path="res://src/ui_widgets/BetterLineEdit.gd" id="2_4uivs"]

[node name="PointsField" type="VBoxContainer"]
offset_right = 358.0
offset_right = 300.0
offset_bottom = 45.0
theme_override_constants/separation = 2
script = ExtResource("1_pnk5w")

[node name="LineEdit" type="LineEdit" parent="."]
custom_minimum_size = Vector2(358, 0)
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
size_flags_horizontal = 0
focus_mode = 1
script = ExtResource("2_4uivs")
mono_font_tooltip = true

[node name="Points" type="Control" parent="."]
custom_minimum_size = Vector2(344, 0)
custom_minimum_size = Vector2(295, 0)
layout_mode = 2
size_flags_horizontal = 8
18 changes: 15 additions & 3 deletions src/ui_widgets/zoom_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const MAX_ZOOM = 512.0
signal zoom_changed(zoom_level: float, offset: Vector2)
signal zoom_reset_pressed

@onready var zoom_out_button: BetterButton = $ZoomOut
@onready var zoom_in_button: BetterButton = $ZoomIn
@onready var zoom_reset_button: BetterButton = $ZoomReset
@onready var zoom_out_button: Button = $ZoomOut
@onready var zoom_in_button: Button = $ZoomIn
@onready var zoom_reset_button: Button = $ZoomReset

var _zoom_level: float

Expand Down Expand Up @@ -71,3 +71,15 @@ func update_buttons_appearance() -> void:
zoom_out_button.disabled = is_min_zoom
zoom_out_button.mouse_default_cursor_shape = Control.CURSOR_ARROW if\
is_min_zoom else Control.CURSOR_POINTING_HAND


func _on_zoom_out_pressed() -> void:
HandlerGUI.throw_action_event("zoom_out")


func _on_zoom_reset_pressed() -> void:
HandlerGUI.throw_action_event("zoom_reset")


func _on_zoom_in_pressed() -> void:
HandlerGUI.throw_action_event("zoom_in")
13 changes: 5 additions & 8 deletions src/ui_widgets/zoom_menu.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://oltvrf01xrxl"]
[gd_scene load_steps=4 format=3 uid="uid://oltvrf01xrxl"]

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

[node name="ZoomMenu" type="HBoxContainer"]
offset_right = 114.0
Expand All @@ -18,17 +17,13 @@ mouse_default_cursor_shape = 2
theme_type_variation = &"IconButton"
icon = ExtResource("1_8ggy2")
icon_alignment = 1
script = ExtResource("3_vgfv3")
action = "zoom_out"

[node name="ZoomReset" type="Button" parent="."]
custom_minimum_size = Vector2(58, 0)
layout_mode = 2
focus_mode = 0
mouse_default_cursor_shape = 2
text = "100%"
script = ExtResource("3_vgfv3")
action = "zoom_reset"

[node name="ZoomIn" type="Button" parent="."]
layout_mode = 2
Expand All @@ -37,5 +32,7 @@ mouse_default_cursor_shape = 2
theme_type_variation = &"IconButton"
icon = ExtResource("2_284x5")
icon_alignment = 1
script = ExtResource("3_vgfv3")
action = "zoom_in"

[connection signal="pressed" from="ZoomOut" to="." method="_on_zoom_out_pressed"]
[connection signal="pressed" from="ZoomReset" to="." method="_on_zoom_reset_pressed"]
[connection signal="pressed" from="ZoomIn" to="." method="_on_zoom_in_pressed"]