From 506afd9e38cad2ab0752734b79ef02da0864db67 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Mon, 21 Sep 2026 12:07:13 +0800 Subject: fix(desktop): 键位页键名列统一宽度不叠印 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Controls 页按键名列独立成列(ControlsKeyX/KeyWidth=120/ActionX),controlRowRects 纯函数返回键名与动作矩形,回归测试断言逐行矩形不相交、全部行键名列 x/宽度一致、列宽容纳最长键名 F1/F2/F3;面板上移至 ControlsPanelY 保证 14 行键位加页脚完整落入视口。 --- src/LivingVillage.Desktop/Game.fs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/LivingVillage.Desktop/Game.fs') diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index 7337129..25b8c48 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -547,6 +547,8 @@ type LivingVillageGame() as this = | LoadError -> 4 | Playing -> 0 let rowHeight = if menu.Page = Controls then 25 else layout.MenuLineHeight + let panelY = + if menu.Page = Controls then layout.ControlsPanelY else layout.PanelY let panelHeight = min (height - panelY - 16) (max layout.PanelHeight (120 + contentRows * rowHeight + 48)) @@ -622,7 +624,9 @@ type LivingVillageGame() as this = drawText innerX (layout.HeadingY) mutedColor (ChineseText.menuHeading ControlsHeading) MenuState.controlRows |> List.iteri (fun index row -> - drawText innerX (contentY + index * 25) textColor (sprintf "%s %s" row.Keys row.Action)) + let keyRect, actionRect = TitleScreen.controlRowRects layout index + PixelText.draw spriteBatch pixel cjkAtlas keyRect.X keyRect.Y textScale textColor row.Keys + PixelText.draw spriteBatch pixel cjkAtlas actionRect.X actionRect.Y textScale textColor row.Action) drawText innerX (panelY + panelHeight - 40) mutedColor "ESC 返回" | LoadError -> drawText innerX (layout.HeadingY) (Color(240, 130, 120)) "读取失败" -- cgit v1.2.3