diff --git a/src/Tools/SelectionTools/SelectionTool.gd b/src/Tools/SelectionTools/SelectionTool.gd index 6774e9277..5aa3dba56 100644 --- a/src/Tools/SelectionTools/SelectionTool.gd +++ b/src/Tools/SelectionTools/SelectionTool.gd @@ -21,11 +21,7 @@ onready var hspinbox : SpinBox = find_node("HSpinBox") func _ready() -> void: - var select_rect : Rect2 = selection_node.big_bounding_rectangle - xspinbox.value = select_rect.position.x - yspinbox.value = select_rect.position.y - wspinbox.value = select_rect.size.x - hspinbox.value = select_rect.size.y + set_spinbox_values() func _input(event : InputEvent) -> void: @@ -41,6 +37,19 @@ func _input(event : InputEvent) -> void: _snap_to_grid = false +func set_spinbox_values() -> void: + var select_rect : Rect2 = selection_node.big_bounding_rectangle + xspinbox.editable = !select_rect.has_no_area() + yspinbox.editable = !select_rect.has_no_area() + wspinbox.editable = !select_rect.has_no_area() + hspinbox.editable = !select_rect.has_no_area() + + xspinbox.value = select_rect.position.x + yspinbox.value = select_rect.position.y + wspinbox.value = select_rect.size.x + hspinbox.value = select_rect.size.y + + func draw_start(position : Vector2) -> void: if selection_node.arrow_key_move: return diff --git a/src/UI/Canvas/Selection.gd b/src/UI/Canvas/Selection.gd index 9585f3193..16a1c1a54 100644 --- a/src/UI/Canvas/Selection.gd +++ b/src/UI/Canvas/Selection.gd @@ -229,10 +229,7 @@ func _big_bounding_rectangle_changed(value : Rect2) -> void: big_bounding_rectangle = value for slot in Tools._slots.values(): if slot.tool_node is SelectionTool: - slot.tool_node.xspinbox.value = value.position.x - slot.tool_node.yspinbox.value = value.position.y - slot.tool_node.wspinbox.value = value.size.x - slot.tool_node.hspinbox.value = value.size.y + slot.tool_node.set_spinbox_values() update_gizmos()