feat(components): unify interaction states for Button and Slider - #65
Open
FarnaHerry wants to merge 1 commit into
Open
feat(components): unify interaction states for Button and Slider#65FarnaHerry wants to merge 1 commit into
FarnaHerry wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中文说明
为什么做这个改动
当前组件已经分别拥有部分
normal、hover、pressed、focused、disabled行为,但这些状态没有统一的基础模型和主题 token。结果是不同控件的状态优先级和视觉反馈不一致:Button 有 hover/pressed,Input 有自己的 focus 样式,而 Slider 主要依赖鼠标拖动,缺少 disabled/focus 反馈。这次 PR 先做一个小范围、可审查的基础接入,不重做键盘 Tab 导航、不修改字体,也不引入平台 accessibility bridge。
做了什么
components/theme.h增加共享的ControlState:NormalHoveredPressedFocusedDisabledInteractionTokens,统一提供 hover border、pressed overlay、focus ring、disabled fill/content 和 focus ring 几何参数。Disabled > Pressed > Focused > Hovered > Normalchecked、selected、expanded等保持为正交的可叠加状态。disabled(bool),接入 focusable/disabled 行为、knob 高亮和 focus ring。examples/control_states_demo.cpp,展示 Button、Checkbox、Switch、Input 和 Slider 的状态反馈。明确不包含
验证
已通过:
Demo 启动命令:
请重点 review:
InteractionTokens是否适合作为后续控件接入的公共基础;