diff --git a/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd b/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd index f271616af..6f12fdcbd 100644 --- a/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd +++ b/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd @@ -5,9 +5,7 @@ var offset := Vector2(5, 5) var color := Color.black var shader: Shader = load("res://src/Shaders/DropShadow.tres") -onready var x_spinbox: SpinBox = $VBoxContainer/OptionsContainer/XSpinBox -onready var y_spinbox: SpinBox = $VBoxContainer/OptionsContainer/YSpinBox -onready var shadow_color = $VBoxContainer/OptionsContainer/ShadowColor +onready var shadow_color := $VBoxContainer/OptionsContainer/ShadowColor as ColorPickerButton func _ready() -> void: @@ -61,20 +59,11 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi yield(gen, "done") -func _on_XSpinBox_value_changed(value) -> void: - x_spinbox.max_value = value + 1 - x_spinbox.min_value = value - 1 - offset.x = value +func _on_OffsetSliders_value_changed(value: Vector2) -> void: + offset = value update_preview() -func _on_YSpinBox_value_changed(value) -> void: - y_spinbox.max_value = value + 1 - y_spinbox.min_value = value - 1 - offset.y = value - update_preview() - - -func _on_OutlineColor_color_changed(_color: Color) -> void: - color = _color +func _on_OutlineColor_color_changed(value: Color) -> void: + color = value update_preview() diff --git a/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn b/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn index d2898075a..4149a0344 100644 --- a/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=1] [ext_resource path="res://src/UI/Dialogs/ImageEffects/DropShadowDialog.gd" type="Script" id=2] +[ext_resource path="res://src/UI/Nodes/ValueSliderV2.tscn" type="PackedScene" id=3] [node name="DropShadowDialog" type="ConfirmationDialog"] margin_right = 294.0 @@ -15,16 +16,16 @@ script = ExtResource( 2 ) margin_left = 8.0 margin_top = 8.0 margin_right = 286.0 -margin_bottom = 334.0 +margin_bottom = 340.0 [node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] -margin_right = 278.0 +margin_right = 279.0 margin_bottom = 200.0 size_flags_vertical = 3 [node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 39.0 -margin_right = 239.0 +margin_left = 39.5 +margin_right = 239.5 margin_bottom = 200.0 rect_min_size = Vector2( 200, 200 ) expand = true @@ -39,7 +40,7 @@ margin_bottom = 0.0 [node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"] margin_top = 204.0 -margin_right = 278.0 +margin_right = 279.0 margin_bottom = 308.0 custom_constants/vseparation = 4 custom_constants/hseparation = 4 @@ -48,44 +49,24 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="XLabel" type="Label" parent="VBoxContainer/OptionsContainer"] -margin_top = 5.0 +[node name="Label" type="Label" parent="VBoxContainer/OptionsContainer"] +margin_top = 19.0 margin_right = 160.0 -margin_bottom = 19.0 +margin_bottom = 33.0 size_flags_horizontal = 3 -text = "Offset X:" +text = "Offset:" -[node name="XSpinBox" type="SpinBox" parent="VBoxContainer/OptionsContainer"] +[node name="OffsetSliders" parent="VBoxContainer/OptionsContainer" instance=ExtResource( 3 )] margin_left = 164.0 -margin_right = 278.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -max_value = 5.0 -value = 5.0 +margin_right = 279.0 +value = Vector2( 5, 5 ) +min_value = Vector2( -64, -64 ) +max_value = Vector2( 64, 64 ) allow_greater = true allow_lesser = true -suffix = "px" - -[node name="YLabel" type="Label" parent="VBoxContainer/OptionsContainer"] -margin_top = 33.0 -margin_right = 160.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Offset Y:" - -[node name="YSpinBox" type="SpinBox" parent="VBoxContainer/OptionsContainer"] -margin_left = 164.0 -margin_top = 28.0 -margin_right = 278.0 -margin_bottom = 52.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -max_value = 5.0 -value = 5.0 -allow_greater = true -allow_lesser = true -suffix = "px" +show_ratio = true +suffix_x = "px" +suffix_y = "px" [node name="ShadowColorLabel" type="Label" parent="VBoxContainer/OptionsContainer"] margin_top = 59.0 @@ -97,7 +78,7 @@ text = "Shadow color:" [node name="ShadowColor" type="ColorPickerButton" parent="VBoxContainer/OptionsContainer"] margin_left = 164.0 margin_top = 56.0 -margin_right = 278.0 +margin_right = 279.0 margin_bottom = 76.0 rect_min_size = Vector2( 64, 20 ) size_flags_horizontal = 3 @@ -115,7 +96,7 @@ text = "Only affect selection" [node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] margin_left = 164.0 margin_top = 80.0 -margin_right = 278.0 +margin_right = 279.0 margin_bottom = 104.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 @@ -124,9 +105,9 @@ items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1 selected = 0 [node name="AnimationOptions" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 388.0 -margin_right = 326.0 -margin_bottom = 422.0 +margin_top = 312.0 +margin_right = 279.0 +margin_bottom = 346.0 [node name="Label" type="Label" parent="VBoxContainer/AnimationOptions"] margin_top = 10.0 @@ -136,7 +117,7 @@ text = "Animate :" [node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/AnimationOptions"] margin_left = 66.0 -margin_right = 205.0 +margin_right = 158.0 margin_bottom = 34.0 size_flags_horizontal = 3 @@ -144,7 +125,7 @@ size_flags_horizontal = 3 unique_name_in_owner = true margin_left = 7.0 margin_top = 7.0 -margin_right = 132.0 +margin_right = 85.0 margin_bottom = 27.0 focus_mode = 2 text = "Properties" @@ -152,11 +133,10 @@ flat = false [node name="InitalButton" type="Button" parent="VBoxContainer/AnimationOptions"] unique_name_in_owner = true -margin_left = 209.0 -margin_right = 326.0 +margin_left = 162.0 +margin_right = 279.0 margin_bottom = 34.0 text = "Set initial values" -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/XSpinBox" to="." method="_on_XSpinBox_value_changed"] -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/YSpinBox" to="." method="_on_YSpinBox_value_changed"] +[connection signal="value_changed" from="VBoxContainer/OptionsContainer/OffsetSliders" to="." method="_on_OffsetSliders_value_changed"] [connection signal="color_changed" from="VBoxContainer/OptionsContainer/ShadowColor" to="." method="_on_OutlineColor_color_changed"]