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/TitleScreen.fs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/LivingVillage.Desktop/TitleScreen.fs') diff --git a/src/LivingVillage.Desktop/TitleScreen.fs b/src/LivingVillage.Desktop/TitleScreen.fs index 00cf5b8..7ec46d2 100644 --- a/src/LivingVillage.Desktop/TitleScreen.fs +++ b/src/LivingVillage.Desktop/TitleScreen.fs @@ -29,7 +29,12 @@ module TitleScreen = FirstItemY: int CursorX: int CursorWidth: int - TextX: int } + TextX: int + ControlsPanelY: int + ControlsRowHeight: int + ControlsKeyX: int + ControlsKeyWidth: int + ControlsActionX: int } type TextRect = { X: int @@ -43,6 +48,13 @@ module TitleScreen = || a.Y + a.Height <= b.Y || b.Y + b.Height <= a.Y + /// Key-name and action rectangles for one controls-page row. The key column has a + /// fixed width shared by every row, so all action texts start on the same x. + let controlRowRects (layout: TitleLayout) (rowIndex: int) : TextRect * TextRect = + let y = layout.FirstItemY + rowIndex * layout.ControlsRowHeight + { X = layout.ControlsKeyX; Y = y; Width = layout.ControlsKeyWidth; Height = 16 }, + { X = layout.ControlsActionX; Y = y; Width = layout.PanelX + layout.PanelWidth - layout.ControlsActionX - 24; Height = 16 } + /// Cursor and label rectangles for one menu row. The cursor is drawn in its own /// column; the label always starts to the right of it, so they can never overprint. let selectionRects (layout: TitleLayout) (rowIndex: int) : TextRect * TextRect = @@ -111,4 +123,9 @@ module TitleScreen = FirstItemY = height / 2 - 64 + 60 CursorX = (width - panelWidth) / 2 + 24 CursorWidth = 20 - TextX = (width - panelWidth) / 2 + 24 + 20 + 12 } + TextX = (width - panelWidth) / 2 + 24 + 20 + 12 + ControlsPanelY = max 16 (height - 480) + ControlsRowHeight = 25 + ControlsKeyX = (width - panelWidth) / 2 + 24 + ControlsKeyWidth = 120 + ControlsActionX = (width - panelWidth) / 2 + 24 + 120 + 12 } -- cgit v1.2.3