mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Use a HFlowContainer for the Tools
This commit requires Godot 3.5 and Pixelorama will no longer run in older Godot versions
This commit is contained in:
parent
ef0adf55b1
commit
afe5a90722
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Reference in a new issue