@@ -32,6 +32,8 @@ var pallette_colors = [
3232const AUTO_SIZE_PADDING : int = 22
3333const AUTO_SIZE_TOP_PADDING : int = 72
3434
35+ var is_resizing : bool = false
36+ var undo_action : Dictionary = { type = "resize_comment" }
3537
3638func do_set_position (o : Vector2 ) -> void :
3739 disable_undoredo_for_offset = true
@@ -40,16 +42,18 @@ func do_set_position(o : Vector2) -> void:
4042 disable_undoredo_for_offset = false
4143
4244func _on_resize_request (new_size : Vector2 ) -> void :
43- var parent : GraphEdit = get_parent ()
44- if parent .snapping_enabled :
45- new_size = parent .snapping_distance * Vector2 (round (new_size .x / parent .snapping_distance ), round (new_size .y / parent .snapping_distance ))
46- if size == new_size :
45+ if is_resizing :
4746 return
48- var undo_action = { type = "resize_comment" , node = generator .get_hier_name (), size = size }
49- var redo_action = { type = "resize_comment" , node = generator .get_hier_name (), size = new_size }
50- get_parent ().undoredo .add ("Resize comment" , [undo_action ], [redo_action ], true )
47+ undo_action = { type = "resize_comment" , node = generator .get_hier_name (), size = new_size }
48+ is_resizing = true
49+ size = new_size
50+
51+ func _on_resize_end (new_size : Vector2 ) -> void :
52+ is_resizing = false
5153 size = new_size
5254 generator .size = new_size
55+ var redo_action := { type = "resize_comment" , node = generator .get_hier_name (), size = size }
56+ get_parent ().undoredo .add ("Resize comment" , [undo_action ], [redo_action ], true )
5357
5458func resize_to_selection () -> void :
5559 # If any nodes are selected on initialization automatically adjust size to match
@@ -95,6 +99,12 @@ func _on_gui_input(event):
9599 mouse_default_cursor_shape = Control .CURSOR_FDIAGSIZE
96100 else :
97101 mouse_default_cursor_shape = Control .CURSOR_ARROW
102+ if event is InputEventMouseButton and event .double_click and event .button_index == MOUSE_BUTTON_LEFT :
103+ editor .editable = true
104+ editor .mouse_filter = MOUSE_FILTER_STOP
105+ editor .select_all ()
106+ editor .grab_focus ()
107+ accept_event ()
98108
99109func _on_Title_gui_input (event ):
100110 if event is InputEventMouseButton and event .double_click and event .button_index == MOUSE_BUTTON_LEFT :
@@ -116,17 +126,9 @@ func _on_title_edit_text_submitted(_new_text):
116126
117127# Text edit
118128
119- func _on_text_gui_input (event ):
120- if event is InputEventMouseButton and event .double_click and event .button_index == MOUSE_BUTTON_LEFT :
121- editor .editable = true
122- editor .mouse_filter = MOUSE_FILTER_STOP
123- editor .select_all ()
124- editor .grab_focus ()
125- accept_event ()
126-
127129func _on_text_focus_exited ():
128130 editor .editable = false
129- editor .mouse_filter = MOUSE_FILTER_PASS
131+ editor .mouse_filter = MOUSE_FILTER_IGNORE
130132 generator .text = editor .text
131133
132134# Comment color
@@ -183,10 +185,19 @@ func _on_ColorChooser_gui_input(event: InputEvent) -> void:
183185 $ PopupSelector .get_window ().content_scale_factor = content_scale_factor
184186 $ PopupSelector .get_window ().min_size = $ PopupSelector .get_window ().get_contents_minimum_size () * content_scale_factor
185187 $ PopupSelector .get_window ().position = get_global_mouse_position () * content_scale_factor
188+ var color_picker : ColorPicker = $ PopupSelector/PanelContainer/ColorPicker
189+ $ PopupSelector .about_to_popup .connect (func ():
190+ if mm_globals .has_config ("color_picker_color_mode" ):
191+ color_picker .color_mode = mm_globals .get_config ("color_picker_color_mode" )
192+ if mm_globals .has_config ("color_picker_shape" ):
193+ color_picker .picker_shape = mm_globals .get_config ("color_picker_shape" ))
194+ $ PopupSelector .popup_hide .connect (func ():
195+ mm_globals .set_config ("color_picker_color_mode" , color_picker .color_mode )
196+ mm_globals .set_config ("color_picker_shape" , color_picker .picker_shape ))
186197 $ PopupSelector .popup ()
187- $ PopupSelector/PanelContainer/ColorPicker .color = generator .color
188- if not $ PopupSelector/PanelContainer/ColorPicker .color_changed .is_connected (self .set_color ):
189- $ PopupSelector/PanelContainer/ColorPicker .color_changed .connect (self .set_color )
198+ color_picker .color = generator .color
199+ if not color_picker .color_changed .is_connected (self .set_color ):
200+ color_picker .color_changed .connect (self .set_color )
190201
191202func _on_close_pressed ():
192203 get_parent ().remove_node (self )
0 commit comments