diff --git a/src/UI/ToolButtons.gd b/src/UI/ToolButtons.gd index a6ab2396e..4496f5242 100644 --- a/src/UI/ToolButtons.gd +++ b/src/UI/ToolButtons.gd @@ -1,9 +1,4 @@ -extends GridContainer - - -func _ready() -> void: - # Resize tools panel when window gets resized - get_tree().get_root().connect("size_changed", self, "_on_Tools_resized") +extends FlowContainer func _input(event: InputEvent) -> void: @@ -33,14 +28,3 @@ func _on_Tool_pressed(tool_pressed: BaseButton) -> void: button = BUTTON_RIGHT if Input.is_action_just_released("right_mouse") else button if button != -1: Tools.assign_tool(tool_pressed.name, button) - - -func _on_Tools_resized() -> void: - var tool_panel_size: Vector2 = get_parent().get_parent().rect_size - var column_n = tool_panel_size.x / 28.5 - if Global.tool_button_size == Global.ButtonSize.BIG: - column_n = tool_panel_size.x / 36.5 - - if column_n < 1: - column_n = 1 - columns = column_n diff --git a/src/UI/Tools.tscn b/src/UI/Tools.tscn index f1ca9d5ca..ed8d332a3 100644 --- a/src/UI/Tools.tscn +++ b/src/UI/Tools.tscn @@ -12,21 +12,16 @@ size_flags_horizontal = 0 size_flags_vertical = 0 [node name="PanelContainer" type="PanelContainer" parent="."] -margin_right = 14.0 +margin_right = 38.0 margin_bottom = 14.0 -size_flags_horizontal = 0 -size_flags_vertical = 0 +size_flags_horizontal = 3 __meta__ = { "_edit_use_anchors_": false } -[node name="ToolButtons" type="GridContainer" parent="PanelContainer"] +[node name="ToolButtons" type="HFlowContainer" parent="PanelContainer"] margin_left = 7.0 margin_top = 7.0 -margin_right = 7.0 +margin_right = 31.0 margin_bottom = 7.0 -size_flags_horizontal = 0 -size_flags_vertical = 0 script = ExtResource( 3 ) - -[connection signal="resized" from="." to="PanelContainer/ToolButtons" method="_on_Tools_resized"]