@@ -8,56 +8,66 @@ var image := Image.create(1, 1, false, Image.FORMAT_RGBA8)
8
8
9
9
@onready var width_spinbox : SpinBox = $ VBoxContainer/OptionsContainer/WidthValue
10
10
@onready var height_spinbox : SpinBox = $ VBoxContainer/OptionsContainer/HeightValue
11
- @onready var x_spinbox : SpinBox = $ VBoxContainer/OptionsContainer/XSpinBox
12
- @onready var y_spinbox : SpinBox = $ VBoxContainer/OptionsContainer/YSpinBox
11
+ @onready var x_offset_spinbox : SpinBox = $ VBoxContainer/OptionsContainer/XOffsetSpinBox
12
+ @onready var y_offset_spinbox : SpinBox = $ VBoxContainer/OptionsContainer/YOffsetSpinBox
13
13
@onready var aspect_ratio_container : AspectRatioContainer = $ VBoxContainer/AspectRatioContainer
14
14
@onready var preview_rect : TextureRect = $ VBoxContainer/AspectRatioContainer/Preview
15
15
16
16
17
- func _on_ResizeCanvas_about_to_show () -> void :
17
+ func _on_about_to_popup () -> void :
18
18
Global .canvas .selection .transform_content_confirm ()
19
19
image .resize (Global .current_project .size .x , Global .current_project .size .y )
20
20
image .fill (Color (0.0 , 0.0 , 0.0 , 0.0 ))
21
21
var frame := Global .current_project .frames [Global .current_project .current_frame ]
22
22
DrawingAlgos .blend_layers (image , frame )
23
- width_spinbox .value = Global .current_project .size .x
24
- height_spinbox .value = Global .current_project .size .y
23
+ if width_spinbox .value == Global .current_project .size .x :
24
+ _on_width_value_changed (width_spinbox .value )
25
+ else :
26
+ width_spinbox .value = Global .current_project .size .x
27
+ if height_spinbox .value == Global .current_project .size .y :
28
+ _on_height_value_changed (height_spinbox .value )
29
+ else :
30
+ height_spinbox .value = Global .current_project .size .y
25
31
update_preview ()
26
32
27
33
28
- func _on_ResizeCanvas_confirmed () -> void :
34
+ func _on_confirmed () -> void :
29
35
DrawingAlgos .resize_canvas (width , height , offset_x , offset_y )
30
36
31
37
32
- func _on_WidthValue_value_changed (value : int ) -> void :
38
+ func _on_width_value_changed (value : int ) -> void :
33
39
width = value
34
- x_spinbox .min_value = mini (width - Global .current_project .size .x , 0 )
35
- x_spinbox .max_value = maxi (width - Global .current_project .size .x , 0 )
36
- x_spinbox .value = clampi (x_spinbox .value , x_spinbox .min_value , x_spinbox .max_value )
40
+ x_offset_spinbox .min_value = mini (width - Global .current_project .size .x , 0 )
41
+ x_offset_spinbox .max_value = maxi (width - Global .current_project .size .x , 0 )
42
+ x_offset_spinbox .value = clampi (
43
+ x_offset_spinbox .value , x_offset_spinbox .min_value , x_offset_spinbox .max_value
44
+ )
37
45
update_preview ()
38
46
39
47
40
- func _on_HeightValue_value_changed (value : int ) -> void :
48
+ func _on_height_value_changed (value : int ) -> void :
41
49
height = value
42
- y_spinbox .min_value = mini (height - Global .current_project .size .y , 0 )
43
- y_spinbox .max_value = maxi (height - Global .current_project .size .y , 0 )
44
- y_spinbox .value = clampi (y_spinbox .value , y_spinbox .min_value , y_spinbox .max_value )
50
+ y_offset_spinbox .min_value = mini (height - Global .current_project .size .y , 0 )
51
+ y_offset_spinbox .max_value = maxi (height - Global .current_project .size .y , 0 )
52
+ y_offset_spinbox .value = clampi (
53
+ y_offset_spinbox .value , y_offset_spinbox .min_value , y_offset_spinbox .max_value
54
+ )
45
55
update_preview ()
46
56
47
57
48
- func _on_XSpinBox_value_changed (value : int ) -> void :
58
+ func _on_x_offset_spin_box_value_changed (value : int ) -> void :
49
59
offset_x = value
50
60
update_preview ()
51
61
52
62
53
- func _on_YSpinBox_value_changed (value : int ) -> void :
63
+ func _on_y_offset_spin_box_value_changed (value : int ) -> void :
54
64
offset_y = value
55
65
update_preview ()
56
66
57
67
58
- func _on_CenterButton_pressed () -> void :
59
- x_spinbox .value = (x_spinbox .min_value + x_spinbox .max_value ) / 2
60
- y_spinbox .value = (y_spinbox .min_value + y_spinbox .max_value ) / 2
68
+ func _on_center_button_pressed () -> void :
69
+ x_offset_spinbox .value = (x_offset_spinbox .min_value + x_offset_spinbox .max_value ) / 2
70
+ y_offset_spinbox .value = (y_offset_spinbox .min_value + y_offset_spinbox .max_value ) / 2
61
71
62
72
63
73
func update_preview () -> void :
0 commit comments