feat: add responsive market slot adapter
This commit is contained in:
@@ -211,6 +211,12 @@ reintroduced text crowding. The trial was reverted and is recorded as an issue;
|
||||
the next bounded task is a responsive Market slot adapter, not a page-wide
|
||||
rewrite.
|
||||
|
||||
Responsive slot adapter (`working tree`, 2026-09-09):
|
||||
`ABGM52MarketSlotAdapter` now owns compact-versus-wide normalized geometry. The
|
||||
760x360 and 844x390 canvas family receives a wider/taller ledger and separated
|
||||
card slots, while 1280x720 preserves the existing composition. Its focused
|
||||
geometry contract passes; module integration remains the next step.
|
||||
|
||||
Cost-slot correction (`bfc2f5f`, 2026-09-09): the cost module now uses
|
||||
three explicit columns—availability, centered coin icon, and amount—and the
|
||||
ledger gives that row a wider normalized slot. RecruitCard shares the same
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# M52 Market Slot Adapter Contract
|
||||
|
||||
`ABGM52MarketSlotAdapter` is the geometry boundary between the fixed 16:9
|
||||
Market composition and reusable UI modules. It does not own art, text, state or
|
||||
intent wiring.
|
||||
|
||||
## Compact landscape rule
|
||||
|
||||
For a design-canvas width below 900px (the 760x360 and 844x390 fixtures), the
|
||||
adapter uses three narrower card slots on the left and a `0.375`-wide ledger on
|
||||
the right. The ledger is also taller so its 48px action dock has real room.
|
||||
|
||||
For the 1280x720 fixture, the existing wide slots remain unchanged.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- `m52_market_slot_adapter_test.gd` checks the compact ledger minimum, card
|
||||
separation and wide-layout preservation.
|
||||
- The adapter must be used before mounting `RecruitCard` and `CandidateLedger`
|
||||
into Market; direct use of the old fixed slots is not accepted for the M52
|
||||
component integration.
|
||||
@@ -0,0 +1,23 @@
|
||||
extends SceneTree
|
||||
|
||||
const Adapter = preload("res://ui/m52/market_slot_adapter.gd")
|
||||
|
||||
func _initialize() -> void:
|
||||
var compact := Vector2(640, 360)
|
||||
var wide := Vector2(1280, 720)
|
||||
var compact_cards := Adapter.card_areas(compact)
|
||||
var compact_ledger := Adapter.ledger_area(compact)
|
||||
var wide_cards := Adapter.card_areas(wide)
|
||||
var wide_ledger := Adapter.ledger_area(wide)
|
||||
var ok := compact_cards.size() == 3
|
||||
ok = ok and Adapter.is_compact(compact) and not Adapter.is_compact(wide)
|
||||
ok = ok and compact_ledger.size.x * compact.x >= 230.0 and compact_ledger.size.y * compact.y >= 290.0
|
||||
ok = ok and wide_ledger == Rect2(0.655, 0.205, 0.310, 0.635)
|
||||
for card in compact_cards:
|
||||
ok = ok and card.end.x < compact_ledger.position.x
|
||||
if ok:
|
||||
print("ABG_M52_MARKET_SLOT_ADAPTER_OK compact=true ledger_min=230x290 card_gap=true wide_preserved=true")
|
||||
quit(0)
|
||||
else:
|
||||
push_error("MarketSlotAdapter geometry contract failed")
|
||||
quit(1)
|
||||
@@ -0,0 +1,31 @@
|
||||
class_name ABGM52MarketSlotAdapter
|
||||
extends RefCounted
|
||||
|
||||
## Responsive geometry only. This adapter never owns text, art or intents;
|
||||
## it chooses normalized slots for the existing 16:9 Market design canvas.
|
||||
|
||||
const MarketSlots = preload("res://ui/shared/m52_market_slots.gd")
|
||||
|
||||
static func card_areas(canvas_size: Vector2) -> Array[Rect2]:
|
||||
if canvas_size.x < 900.0:
|
||||
# Phone-landscape canvas: keep three cards readable and reserve a wider,
|
||||
# taller ledger on the right. The 8px normalized gap is intentional.
|
||||
return [
|
||||
Rect2(0.040, 0.285, 0.160, 0.545),
|
||||
Rect2(0.215, 0.265, 0.160, 0.565),
|
||||
Rect2(0.390, 0.285, 0.160, 0.545),
|
||||
]
|
||||
var result: Array[Rect2] = []
|
||||
for area in MarketSlots.CARD_AREAS:
|
||||
result.append(area)
|
||||
return result
|
||||
|
||||
static func ledger_area(canvas_size: Vector2) -> Rect2:
|
||||
if canvas_size.x < 900.0:
|
||||
# At 760x360 and 844x390 the ledger gets enough height for a 48px
|
||||
# action dock while remaining clear of the card row horizontally.
|
||||
return Rect2(0.585, 0.095, 0.375, 0.835)
|
||||
return Rect2(0.655, 0.205, 0.310, 0.635)
|
||||
|
||||
static func is_compact(canvas_size: Vector2) -> bool:
|
||||
return canvas_size.x < 900.0
|
||||
Reference in New Issue
Block a user