1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Some more minor changes in rotate image dialog and script

This commit is contained in:
Emmanouil Papadeas 2022-07-25 17:47:01 +03:00
parent 42942d2c0a
commit 68ad07572a
2 changed files with 53 additions and 61 deletions

View file

@ -7,8 +7,8 @@ var drag_pivot := false
onready var type_option_button: OptionButton = $VBoxContainer/HBoxContainer2/TypeOptionButton
onready var pivot_indicator: Control = $VBoxContainer/AspectRatioContainer/Indicator
onready var x_pivot: SpinBox = $VBoxContainer/Pivot/TitleButtons/XPivot
onready var y_pivot: SpinBox = $VBoxContainer/Pivot/TitleButtons/YPivot
onready var x_pivot: SpinBox = $VBoxContainer/TitleButtons/XPivot
onready var y_pivot: SpinBox = $VBoxContainer/TitleButtons/YPivot
onready var angle_hslider: HSlider = $VBoxContainer/AngleOptions/AngleHSlider
onready var angle_spinbox: SpinBox = $VBoxContainer/AngleOptions/AngleSpinBox
onready var wait_apply_timer: Timer = $WaitApply
@ -127,7 +127,7 @@ func commit_action(cel: Image, _project: Project = Global.current_project) -> vo
cel.blit_rect(image, Rect2(Vector2.ZERO, image.get_size()), Vector2.ZERO)
func _on_HSlider_value_changed(_value: float) -> void:
func _on_AngleHSlider_value_changed(_value: float) -> void:
angle_spinbox.value = angle_hslider.value
if live_preview:
update_preview()
@ -135,7 +135,7 @@ func _on_HSlider_value_changed(_value: float) -> void:
wait_apply_timer.start()
func _on_SpinBox_value_changed(_value: float) -> void:
func _on_AngleSpinBox_value_changed(_value: float) -> void:
angle_hslider.value = angle_spinbox.value
@ -165,20 +165,11 @@ func _on_LiveCheckbox_toggled(button_pressed: bool) -> void:
rect_size.y += 1 # Reset rect_size of dialog
func _on_quick_change_angle_pressed(change_type: String) -> void:
func _on_quick_change_angle_pressed(angle_value: int) -> void:
var current_angle := angle_hslider.value
var new_angle := current_angle
match change_type:
"-90":
new_angle = current_angle - 90
"-45":
new_angle = current_angle - 45
"0":
new_angle = 0
"+45":
new_angle = current_angle + 45
"+90":
new_angle = current_angle + 90
var new_angle := current_angle + angle_value
if angle_value == 0:
new_angle = 0
if new_angle < 0:
new_angle = new_angle + 360

View file

@ -21,13 +21,13 @@ margin_bottom = -36.0
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"]
margin_right = 326.0
margin_bottom = 222.0
margin_bottom = 252.0
size_flags_vertical = 3
[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"]
margin_left = 52.0
margin_right = 274.0
margin_bottom = 222.0
margin_left = 37.0
margin_right = 289.0
margin_bottom = 252.0
rect_min_size = Vector2( 200, 200 )
expand = true
stretch_mode = 5
@ -40,15 +40,15 @@ margin_right = 0.0
margin_bottom = 0.0
[node name="Indicator" type="Control" parent="VBoxContainer/AspectRatioContainer"]
margin_left = 52.0
margin_right = 274.0
margin_bottom = 222.0
margin_left = 37.0
margin_right = 289.0
margin_bottom = 252.0
mouse_default_cursor_shape = 2
[node name="LiveSettings" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 226.0
margin_top = 256.0
margin_right = 326.0
margin_bottom = 250.0
margin_bottom = 280.0
alignment = 1
[node name="LiveCheckbox" type="CheckBox" parent="VBoxContainer/LiveSettings"]
@ -86,9 +86,9 @@ editable = false
suffix = "msec"
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 254.0
margin_top = 284.0
margin_right = 326.0
margin_bottom = 274.0
margin_bottom = 304.0
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
margin_top = 3.0
@ -105,20 +105,16 @@ size_flags_horizontal = 3
size_flags_vertical = 3
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
margin_top = 278.0
margin_top = 308.0
margin_right = 326.0
margin_bottom = 282.0
margin_bottom = 312.0
[node name="Pivot" type="VBoxContainer" parent="VBoxContainer"]
margin_top = 286.0
[node name="TitleButtons" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 316.0
margin_right = 326.0
margin_bottom = 310.0
margin_bottom = 340.0
[node name="TitleButtons" type="HBoxContainer" parent="VBoxContainer/Pivot"]
margin_right = 326.0
margin_bottom = 24.0
[node name="Label" type="Label" parent="VBoxContainer/Pivot/TitleButtons"]
[node name="Label" type="Label" parent="VBoxContainer/TitleButtons"]
margin_top = 5.0
margin_right = 70.0
margin_bottom = 19.0
@ -126,7 +122,7 @@ text = "Pivot (x, y):"
align = 2
valign = 1
[node name="XPivot" type="SpinBox" parent="VBoxContainer/Pivot/TitleButtons"]
[node name="XPivot" type="SpinBox" parent="VBoxContainer/TitleButtons"]
margin_left = 74.0
margin_right = 169.0
margin_bottom = 24.0
@ -138,7 +134,7 @@ step = 0.5
allow_greater = true
allow_lesser = true
[node name="YPivot" type="SpinBox" parent="VBoxContainer/Pivot/TitleButtons"]
[node name="YPivot" type="SpinBox" parent="VBoxContainer/TitleButtons"]
margin_left = 173.0
margin_right = 268.0
margin_bottom = 24.0
@ -150,7 +146,7 @@ step = 0.5
allow_greater = true
allow_lesser = true
[node name="Centre" type="Button" parent="VBoxContainer/Pivot/TitleButtons"]
[node name="Centre" type="Button" parent="VBoxContainer/TitleButtons"]
margin_left = 272.0
margin_right = 326.0
margin_bottom = 24.0
@ -159,14 +155,14 @@ mouse_default_cursor_shape = 2
text = "Center"
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer"]
margin_top = 314.0
margin_top = 344.0
margin_right = 326.0
margin_bottom = 318.0
margin_bottom = 348.0
[node name="AngleOptions" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 322.0
margin_top = 352.0
margin_right = 326.0
margin_bottom = 346.0
margin_bottom = 376.0
[node name="Label" type="Label" parent="VBoxContainer/AngleOptions"]
margin_top = 5.0
@ -195,50 +191,55 @@ max_value = 359.0
suffix = "°"
[node name="QuickRotations" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 350.0
margin_top = 380.0
margin_right = 326.0
margin_bottom = 370.0
margin_bottom = 400.0
alignment = 1
[node name="Deduct90" type="Button" parent="VBoxContainer/QuickRotations"]
margin_left = 76.0
margin_right = 109.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "-90"
[node name="Deduct45" type="Button" parent="VBoxContainer/QuickRotations"]
margin_left = 113.0
margin_right = 146.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "-45"
[node name="Zero" type="Button" parent="VBoxContainer/QuickRotations"]
margin_left = 150.0
margin_right = 170.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "0"
[node name="Add45" type="Button" parent="VBoxContainer/QuickRotations"]
margin_left = 174.0
margin_right = 210.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "+45"
[node name="Add90" type="Button" parent="VBoxContainer/QuickRotations"]
margin_left = 214.0
margin_right = 250.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "+90"
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer"]
margin_top = 374.0
margin_top = 404.0
margin_right = 326.0
margin_bottom = 378.0
margin_bottom = 408.0
[node name="OptionsContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 382.0
margin_top = 412.0
margin_right = 326.0
margin_bottom = 406.0
margin_bottom = 436.0
[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"]
margin_right = 160.0
@ -263,14 +264,14 @@ selected = 0
[connection signal="toggled" from="VBoxContainer/LiveSettings/LiveCheckbox" to="." method="_on_LiveCheckbox_toggled"]
[connection signal="value_changed" from="VBoxContainer/WaitSettings/WaitTime" to="." method="_on_WaitTime_value_changed"]
[connection signal="item_selected" from="VBoxContainer/HBoxContainer2/TypeOptionButton" to="." method="_on_TypeOptionButton_item_selected"]
[connection signal="value_changed" from="VBoxContainer/Pivot/TitleButtons/XPivot" to="." method="_on_Pivot_value_changed" binds= [ true ]]
[connection signal="value_changed" from="VBoxContainer/Pivot/TitleButtons/YPivot" to="." method="_on_Pivot_value_changed" binds= [ false ]]
[connection signal="pressed" from="VBoxContainer/Pivot/TitleButtons/Centre" to="." method="_on_Centre_pressed"]
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleHSlider" to="." method="_on_HSlider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleSpinBox" to="." method="_on_SpinBox_value_changed"]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Deduct90" to="." method="_on_quick_change_angle_pressed" binds= [ "-90" ]]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Deduct45" to="." method="_on_quick_change_angle_pressed" binds= [ "-45" ]]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Zero" to="." method="_on_quick_change_angle_pressed" binds= [ "0" ]]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Add45" to="." method="_on_quick_change_angle_pressed" binds= [ "+45" ]]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Add90" to="." method="_on_quick_change_angle_pressed" binds= [ "+90" ]]
[connection signal="value_changed" from="VBoxContainer/TitleButtons/XPivot" to="." method="_on_Pivot_value_changed" binds= [ true ]]
[connection signal="value_changed" from="VBoxContainer/TitleButtons/YPivot" to="." method="_on_Pivot_value_changed" binds= [ false ]]
[connection signal="pressed" from="VBoxContainer/TitleButtons/Centre" to="." method="_on_Centre_pressed"]
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleHSlider" to="." method="_on_AngleHSlider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleSpinBox" to="." method="_on_AngleSpinBox_value_changed"]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Deduct90" to="." method="_on_quick_change_angle_pressed" binds= [ -90 ]]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Deduct45" to="." method="_on_quick_change_angle_pressed" binds= [ -45 ]]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Zero" to="." method="_on_quick_change_angle_pressed" binds= [ 0 ]]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Add45" to="." method="_on_quick_change_angle_pressed" binds= [ 45 ]]
[connection signal="pressed" from="VBoxContainer/QuickRotations/Add90" to="." method="_on_quick_change_angle_pressed" binds= [ 90 ]]
[connection signal="timeout" from="WaitApply" to="." method="_on_WaitApply_timeout"]