diff --git a/Changelog.md b/Changelog.md index 07690378e..a3f54fe48 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [v0.6.2] - Unreleased -## Added +### Added - Image layer rotation! Choose between 2 rotation algorithms, Rotxel and Nearest Neighbour - Thanks to azagaya! - Crowdin integration for contributing translations! - Spanish translation - thanks to azagaya! @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Added HSV mode to the color picker. (Added automatically because of the Godot 3.2 update) - Lanczos scaling interpolation. (Added because of the Godot 3.2 update) -## Changed +### Changed - Updates to the Greek, Russian and Traditional Chinese translations. - Replaced some OS alerts with a custom made error dialog. - Made the "X" button on the custom brushes a little smaller. diff --git a/Prefabs/Dialogs/PreferencesDialog.tscn b/Prefabs/Dialogs/PreferencesDialog.tscn index 909330024..7caad69eb 100644 --- a/Prefabs/Dialogs/PreferencesDialog.tscn +++ b/Prefabs/Dialogs/PreferencesDialog.tscn @@ -40,6 +40,17 @@ margin_right = 205.0 margin_bottom = 758.0 size_flags_horizontal = 3 +[node name="General" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] +margin_right = 40.0 +margin_bottom = 40.0 + +[node name="SmoothZoom" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/General"] +margin_right = 24.0 +margin_bottom = 24.0 +mouse_default_cursor_shape = 2 +pressed = true +text = "Smooth Zoom" + [node name="Languages" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] margin_right = 205.0 margin_bottom = 338.0 @@ -205,6 +216,7 @@ text = "Width:" margin_left = 82.0 margin_right = 156.0 margin_bottom = 24.0 +mouse_default_cursor_shape = 2 min_value = 1.0 max_value = 16384.0 value = 1.0 @@ -221,6 +233,7 @@ margin_left = 82.0 margin_top = 28.0 margin_right = 156.0 margin_bottom = 52.0 +mouse_default_cursor_shape = 2 min_value = 1.0 max_value = 16384.0 value = 1.0 @@ -238,6 +251,7 @@ margin_top = 56.0 margin_right = 156.0 margin_bottom = 76.0 rect_min_size = Vector2( 64, 20 ) +mouse_default_cursor_shape = 2 [node name="GuideColorLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"] margin_top = 83.0 @@ -251,6 +265,7 @@ margin_top = 80.0 margin_right = 156.0 margin_bottom = 100.0 rect_min_size = Vector2( 64, 20 ) +mouse_default_cursor_shape = 2 color = Color( 0.63, 0.13, 0.94, 1 ) [node name="Image" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] @@ -282,6 +297,7 @@ text = "Default Width:" margin_left = 114.0 margin_right = 188.0 margin_bottom = 24.0 +mouse_default_cursor_shape = 2 min_value = 1.0 max_value = 16384.0 value = 32.0 @@ -298,6 +314,7 @@ margin_left = 114.0 margin_top = 28.0 margin_right = 188.0 margin_bottom = 52.0 +mouse_default_cursor_shape = 2 min_value = 1.0 max_value = 16384.0 value = 32.0 @@ -315,10 +332,12 @@ margin_top = 56.0 margin_right = 188.0 margin_bottom = 76.0 rect_min_size = Vector2( 64, 20 ) +mouse_default_cursor_shape = 2 color = Color( 0, 0, 0, 0 ) [connection signal="about_to_show" from="." to="." method="_on_PreferencesDialog_about_to_show"] [connection signal="popup_hide" from="." to="." method="_on_PreferencesDialog_popup_hide"] [connection signal="item_selected" from="HSplitContainer/Tree" to="." method="_on_Tree_item_selected"] +[connection signal="pressed" from="HSplitContainer/ScrollContainer/VBoxContainer/General/SmoothZoom" to="." method="_on_SmoothZoom_pressed"] [connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridWidthValue" to="." method="_on_GridWidthValue_value_changed"] [connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridHeightValue" to="." method="_on_GridHeightValue_value_changed"] [connection signal="color_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridColor" to="." method="_on_GridColor_color_changed"] diff --git a/Scripts/CameraMovement.gd b/Scripts/CameraMovement.gd index e444d16f8..0567f1e89 100644 --- a/Scripts/CameraMovement.gd +++ b/Scripts/CameraMovement.gd @@ -1,5 +1,6 @@ extends Camera2D +var tween : Tween var zoom_min := Vector2(0.005, 0.005) var zoom_max := Vector2.ONE var viewport_container : ViewportContainer @@ -7,6 +8,8 @@ var drag := false func _ready() -> void: viewport_container = get_parent().get_parent() + tween = Tween.new() + add_child(tween) func _input(event : InputEvent) -> void: var mouse_pos := viewport_container.get_local_mouse_position() @@ -26,11 +29,22 @@ func _input(event : InputEvent) -> void: # Zoom Camera func zoom_camera(dir : int) -> void: - var zoom_margin = zoom * dir / 10 - if zoom + zoom_margin > zoom_min: - zoom += zoom_margin + if Global.smooth_zoom: + var zoom_margin = zoom * dir / 5 + if zoom + zoom_margin > zoom_min: + tween.interpolate_property(self, "zoom", zoom, zoom + zoom_margin, 0.05, Tween.TRANS_LINEAR, Tween.EASE_IN) + tween.start() - if zoom > zoom_max: - zoom = zoom_max + if zoom > zoom_max: + tween.stop_all() + zoom = zoom_max + + else: + var zoom_margin = zoom * dir / 10 + if zoom + zoom_margin > zoom_min: + zoom += zoom_margin + + if zoom > zoom_max: + zoom = zoom_max if name == "Camera2D": Global.zoom_level_label.text = str(round(100 / Global.camera.zoom.x)) + " %" diff --git a/Scripts/Dialogs/PreferencesDialog.gd b/Scripts/Dialogs/PreferencesDialog.gd index f3a80698a..fffa3b080 100644 --- a/Scripts/Dialogs/PreferencesDialog.gd +++ b/Scripts/Dialogs/PreferencesDialog.gd @@ -2,6 +2,7 @@ extends AcceptDialog onready var tree : Tree = $HSplitContainer/Tree onready var right_side : VBoxContainer = $HSplitContainer/ScrollContainer/VBoxContainer +onready var general = $HSplitContainer/ScrollContainer/VBoxContainer/General onready var languages = $HSplitContainer/ScrollContainer/VBoxContainer/Languages onready var themes = $HSplitContainer/ScrollContainer/VBoxContainer/Themes onready var grid_guides = $"HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides" @@ -72,15 +73,17 @@ func _ready() -> void: func _on_PreferencesDialog_about_to_show() -> void: var root := tree.create_item() + var general_button := tree.create_item(root) var language_button := tree.create_item(root) var theme_button := tree.create_item(root) var grid_button := tree.create_item(root) var image_button := tree.create_item(root) - language_button.set_text(0, " " + tr("Language")) + general_button.set_text(0, " " + tr("General")) # We use metadata to avoid being affected by translations + general_button.set_metadata(0, "General") + language_button.set_text(0, " " + tr("Language")) language_button.set_metadata(0, "Language") - language_button.select(0) theme_button.set_text(0, " " + tr("Themes")) theme_button.set_metadata(0, "Themes") grid_button.set_text(0, " " + tr("Guides & Grid")) @@ -88,6 +91,8 @@ func _on_PreferencesDialog_about_to_show() -> void: image_button.set_text(0, " " + tr("Image")) image_button.set_metadata(0, "Image") + general_button.select(0) + func _on_PreferencesDialog_popup_hide() -> void: tree.clear() @@ -96,7 +101,9 @@ func _on_Tree_item_selected() -> void: for child in right_side.get_children(): child.visible = false var selected : String = tree.get_selected().get_metadata(0) - if "Language" in selected: + if "General" in selected: + general.visible = true + elif "Language" in selected: languages.visible = true elif "Themes" in selected: themes.visible = true @@ -105,6 +112,9 @@ func _on_Tree_item_selected() -> void: elif "Image" in selected: image.visible = true +func _on_SmoothZoom_pressed() -> void: + Global.smooth_zoom = !Global.smooth_zoom + func _on_Language_pressed(button : Button) -> void: var index := 0 var i := -1 @@ -263,4 +273,3 @@ func _on_DefaultBackground_color_changed(color: Color) -> void: Global.default_fill_color = color Global.config_cache.set_value("preferences", "default_fill_color", color) Global.config_cache.save("user://cache.ini") - diff --git a/Scripts/Global.gd b/Scripts/Global.gd index 69857c2cb..b1b70fc70 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -15,6 +15,9 @@ var has_focus := false var canvases := [] # warning-ignore:unused_class_variable var hidden_canvases := [] +enum PRESSURE_SENSITIVITY {NONE, ALPHA, SIZE} +var pressure_sensitivity_mode = PRESSURE_SENSITIVITY.NONE +var smooth_zoom := true var left_cursor_tool_texture : ImageTexture var right_cursor_tool_texture : ImageTexture var transparent_background : ImageTexture