feat: 驾驶舱控制台交互完善(Cockpit Console Refinements) #15
Labels
No labels
ready-for-agent
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
petrezhu/ARK#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
驾驶舱控制台交互完善(Cockpit Console Refinements)
Problem Statement
驾驶舱 UI 已落地三区壳+右舷控制台三页签(日报/飞船/勘探),但存在三个交互断裂点:
此外,船员对话缺少「始终在船上」的陪伴感(需要主动打开浮层),星图被拖乱后无复位手段。
Solution
--console-widthCSS 变量 + localStorage。User Stories
--console-widthvariable that drives all layout rules (panel avoidance, HUD frame inset, console width), so the system stays consistent when I drag.Implementation Decisions
ID1: CSS Variable Architecture (
--console-width):root { --console-width: 460px }incockpit.cssdocument.documentElement.style.setProperty('--console-width', newW + 'px')460px/486pxreferences incockpit.cssandbase.cssreplaced withcalc(var(--console-width) + 12px)orvar(--console-width)inset:10px calc(var(--console-width) + 24px) 10px 10pxark.console.width; on load, restore before first paint (sync script or CSS var in<head>)ID2: Planet→Console Routing (t02 → boot.js)
explorenode click): aftersetLocation(node.id()), callARK.showConsoleTab("explore")instead ofARK.show("sector-detail")ARK.t05.ctx.sectorIdis set synchronously (fire-and-forget fetch for location POST)ARK.show("sector-detail")(original behavior, wide floating panel)typeof ARK.showConsoleTab === "function"before routing (graceful degradation if boot.js not loaded)ID3: Countdown→Console Routing (t10 → boot.js)
ARK.showConsoleTab("briefing"); narrow screen →ARK.show("briefing")(top-drawer)window.matchMedia("(max-width: 1100px)")as the switching conditionID4: Drag Handle
···), 28px tall, positioned at console left bordercursor: col-resize; mousedown/mousemove/mouseup listener (touch not needed: ≤1100px console is drawer, no drag handle)Math.max(300, Math.min(700, startX + deltaX))"W: " + width, appears during drag, hidden on mouseupID5: Crew Mini-Window (t04 extension)
.ark-crew-miniin bottom-left corner (fixed position, above footer)[🧑🚀 船员](120px × 36px)historiesdict)ID6: Star Map Reset Button
.ark-hud-resetin HUD frame bottom-right cornercy.fit(undefined, 60); cy.panBy({ x: -230, y: 0 })(same as initial load positioning)ARK.t02.cy(exposed in t02 build function)ID7: Mouse-based Drag Events Only
Testing Decisions
Test Seams
ARK.showConsoleTab(key)— Highest seam. All tab switching flows through this API. Tests verify: correct tab activates, content renders, no floating panel opens (except Shift-path).setLocation+showConsoleTab("explore")called; Shift-click →ARK.show("sector-detail").showConsoleTab("briefing"); narrow →ARK.show("briefing").--console-widthis set on drag; all panel avoidance rules use it (CSS regression: check computed right values).cy.fit+cy.panBycalled.Test Prior Art
tests/test_fusion_f4.py: boot API aggregation test (existing seam)tests/test_t02_starmap.py: star map API + Cytoscape rendering teststests/test_player_flow.py: full e2e player flow (Playwright, 1440×900 viewport)/tmp/hermes-verify-ark-cockpit.py,/tmp/hermes-verify-ark-tabs.py(pattern: static structure checks + Playwright behavior assertions)External Behavior Focus
--console-widthCSS variable value changes — not mousemove handler internalsARK.t02.cy.pan()result — not click handler wiringOut of Scope
Further Notes
test_player_flow.py step_04); must verify existing ore list rendering still works.ark.console.widthfrom prior sessions get their saved value. No migration script needed.ARK.show("npc")is immersive (full floating panel). They share the samehistoriesdict via t04's IIFE closure.