Documentation
¶
Overview ¶
Package ui 持久化 UI 运行时状态(AGENTS.md §0.5「少量 JSON」)。 与 internal/config(结构性应用配置)区分:这里只放自动记住的运行时 UI 状态, 不进 SQLite(那是业务数据的唯一真相,AGENTS.md §1.5)。
Index ¶
Constants ¶
View Source
const ( MinWidth = 600 MinHeight = 400 )
MinWidth/MinHeight 是恢复时的最小尺寸护栏,防止持久化的过小值导致窗口不可用。
View Source
const MinVisible = 100
MinVisible 是恢复位置时窗口必须与屏幕工作区重叠的最小尺寸(DIP)。
Variables ¶
This section is empty.
Functions ¶
func SaveWindow ¶
func SaveWindow(path string, s WindowState) error
SaveWindow 把窗口状态原子写入 path(先写 .tmp 再 rename,避免半截文件)。
Types ¶
type Bounds ¶
type Bounds struct {
X, Y, Width, Height int
}
Bounds 是一个轴对齐矩形(屏幕工作区或窗口几何),纯值,不耦合 GUI 库,便于单测。
type WindowState ¶
type WindowState struct {
X int `json:"x"`
Y int `json:"y"`
Width int `json:"width"`
Height int `json:"height"`
Maximized bool `json:"maximized"`
}
WindowState 是窗口几何/状态的持久化表示(ui_state.json)。 X/Y/Width/Height 记录的是「正常(非最大化)」几何, Maximized 标记是否应最大化打开。
func LoadWindow ¶
func LoadWindow(path string) (WindowState, error)
LoadWindow 从 path 读取窗口状态。文件不存在视为无记录(零值 + nil)。
Click to show internal directories.
Click to hide internal directories.