From d20a62a26fa1b387a03a89b3a2f13cf3d7619def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Wisniewski?= Date: Thu, 13 Aug 2026 20:54:22 +0200 Subject: [PATCH] Expand contextual actions horizontally --- BuildController.gd | 9 +++++++-- tests/test_hangar_management.gd | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/BuildController.gd b/BuildController.gd index d44eec7..aaf3d08 100644 --- a/BuildController.gd +++ b/BuildController.gd @@ -397,11 +397,16 @@ func _layout_context_buttons() -> void: for button in buttons: button.visible = false return + # Expand sideways so the controls stay in the same visual band instead of + # pushing the player down a vertical stack. Three actions fit across the + # 720px phone layout with the same generous 148px touch targets. for i in range(buttons.size()): var button: Control = buttons[i] button.visible = true - button.offset_top = 488 + i * 164 - button.offset_bottom = button.offset_top + 148 + button.offset_left = 188 + i * 164 + button.offset_right = button.offset_left + 148 + button.offset_top = 324 + button.offset_bottom = 472 func _context_action_buttons() -> Array: diff --git a/tests/test_hangar_management.gd b/tests/test_hangar_management.gd index a842eb0..eb6d399 100644 --- a/tests/test_hangar_management.gd +++ b/tests/test_hangar_management.gd @@ -64,8 +64,8 @@ func _process(delta: float) -> bool: return true # Context actions are compact until expanded. A mothership has three - # choices: research, transfer cargo and hangar, which must receive - # their own non-overlapping berth only after expansion. + # choices: research, transfer cargo and hangar, which unfold in their + # own non-overlapping berths to the right only after expansion. var mothership: Node2D = load("res://Building.tscn").instantiate() mothership.set("building_type", GameState.BUILDING_MOTHERSHIP) controller.current_building = mothership @@ -73,7 +73,7 @@ func _process(delta: float) -> bool: controller._layout_context_buttons() var buttons: Array = [controller.building_action_button, controller.transfer_button, controller.hangar_button] for i in range(buttons.size() - 1): - if buttons[i].offset_bottom > buttons[i + 1].offset_top: + if buttons[i].offset_right > buttons[i + 1].offset_left: _fail("context buttons %d and %d overlap" % [i, i + 1]) return true controller._collapse_context_actions()