Skip to content

feat(ui): let a scroll area draw its bars with the product's own geometry - #12

Merged
1lck merged 1 commit into
mainfrom
feat/1799/ui-scroll-bars
Nov 12, 2026
Merged

1lck merged 1 commit into
mainfrom
feat/1799/ui-scroll-bars

Conversation

@1lck

@1lck 1lck commented Nov 12, 2026

Copy link
Copy Markdown

这个 PR 做什么

components.ScrollBarStyle 上一步只到了 components.ScrollArea,而应用用的 ui.List、ui.Tree、ui.Scroll 都由 ui 内部构造滚动区,应用拿不到那个参数。这次把它透出来:

  • Box.Bars(components.ScrollBarStyle):把样式写进该区域的 ScrollState,paintScrollbars 构造滚动区时应用它。
  • 零值样式仍用 Viva 自己的几何,因此没调用过的页面行为不变。
  • 初始化指南(cmd/viva/initfiles/AGENTS.md.txt)补了 .Bars(...) 说明,ui 的指南校验要求每个导出方法都被列出。

测试

ui/scroll_bars_test.go:

  • 设了样式后区域状态拿到同一份 components.ScrollBarStyle
  • 没设样式时保持零值(Viva 自己的几何)

go test ./ui/ ./components/ ./gfx/ 通过。

…etry

ScrollArea.Bars hands a components.ScrollBarStyle to the area's own state, which the
paint of the bars reads, so a product drawing eleven point tracks with five point
thumbs sets that once per area instead of living with Viva's ten and six. The zero
style keeps Viva's geometry, so nothing changes for a page that never asks for its own
bars. The init guide lists the method.

Tests check that the style reaches the area's state and that an area without one keeps
the zero style.

Co-Authored-By: AtomCode (deepseek-v4.1-flash) <noreply@atomgit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant