feat(Collapse-Bar): 添加折叠/展开动画#3081
Conversation
审查者指南为 MyCollapseBar 实现基于高度的动画折叠/展开行为,包括协调的三角形旋转和对父级 MyCard 动画的抑制,并通过删除外部 toggled 逻辑和依赖条的边距,简化依赖折叠处理。 MyCollapseBar 折叠/展开动画的时序图sequenceDiagram
actor User
participant MyCollapseBar
participant ModAnimation
participant MyCard
User->>MyCollapseBar: header MouseLeftButtonUp
MyCollapseBar->>MyCollapseBar: IsCollapsed setter
alt value == true (collapse)
MyCollapseBar->>ModAnimation: AniStart (triangle rotation)
MyCollapseBar->>MyCollapseBar: CollapseWithAnimation()
MyCollapseBar->>ModAnimation: AniStop(MyCollapseBar Height uuid)
MyCollapseBar->>MyCollapseBar: SilenceParentCard(this)
MyCollapseBar-->>MyCard: UseAnimation = false
MyCollapseBar->>ModAnimation: AniStart(AaHeight, AaCode)
ModAnimation-->>MyCollapseBar: AaCode callback
MyCollapseBar->>MyCollapseBar: _contentPanel.Visibility = Collapsed
MyCollapseBar->>MyCollapseBar: RestoreParentCard(state)
MyCollapseBar-->>MyCard: UseAnimation = original
else value == false (expand)
MyCollapseBar->>ModAnimation: AniStart (triangle rotation)
MyCollapseBar->>MyCollapseBar: ExpandWithAnimation()
MyCollapseBar->>ModAnimation: AniStop(MyCollapseBar Height uuid)
MyCollapseBar->>MyCollapseBar: SilenceParentCard(this)
MyCollapseBar-->>MyCard: UseAnimation = false
MyCollapseBar->>MyCollapseBar: _contentPanel.Visibility = Visible
MyCollapseBar->>MyCollapseBar: Measure, DesiredSize
MyCollapseBar->>ModAnimation: AniStart(AaHeight, AaCode)
ModAnimation-->>MyCollapseBar: AaCode callback
MyCollapseBar->>MyCollapseBar: Height = NaN
MyCollapseBar->>MyCollapseBar: RestoreParentCard(state)
MyCollapseBar-->>MyCard: UseAnimation = original
end
文件级变更
技巧与命令与 Sourcery 交互
自定义你的体验前往你的 dashboard 来:
获取帮助Original review guide in EnglishReviewer's GuideImplements animated height-based collapse/expand behavior for MyCollapseBar, including coordinated triangle rotation and suppression of parent MyCard animations, and simplifies dependency collapse handling by removing external toggled logic and margin from dependency bars. Sequence diagram for MyCollapseBar collapse/expand animationsequenceDiagram
actor User
participant MyCollapseBar
participant ModAnimation
participant MyCard
User->>MyCollapseBar: header MouseLeftButtonUp
MyCollapseBar->>MyCollapseBar: IsCollapsed setter
alt value == true (collapse)
MyCollapseBar->>ModAnimation: AniStart (triangle rotation)
MyCollapseBar->>MyCollapseBar: CollapseWithAnimation()
MyCollapseBar->>ModAnimation: AniStop(MyCollapseBar Height uuid)
MyCollapseBar->>MyCollapseBar: SilenceParentCard(this)
MyCollapseBar-->>MyCard: UseAnimation = false
MyCollapseBar->>ModAnimation: AniStart(AaHeight, AaCode)
ModAnimation-->>MyCollapseBar: AaCode callback
MyCollapseBar->>MyCollapseBar: _contentPanel.Visibility = Collapsed
MyCollapseBar->>MyCollapseBar: RestoreParentCard(state)
MyCollapseBar-->>MyCard: UseAnimation = original
else value == false (expand)
MyCollapseBar->>ModAnimation: AniStart (triangle rotation)
MyCollapseBar->>MyCollapseBar: ExpandWithAnimation()
MyCollapseBar->>ModAnimation: AniStop(MyCollapseBar Height uuid)
MyCollapseBar->>MyCollapseBar: SilenceParentCard(this)
MyCollapseBar-->>MyCard: UseAnimation = false
MyCollapseBar->>MyCollapseBar: _contentPanel.Visibility = Visible
MyCollapseBar->>MyCollapseBar: Measure, DesiredSize
MyCollapseBar->>ModAnimation: AniStart(AaHeight, AaCode)
ModAnimation-->>MyCollapseBar: AaCode callback
MyCollapseBar->>MyCollapseBar: Height = NaN
MyCollapseBar->>MyCollapseBar: RestoreParentCard(state)
MyCollapseBar-->>MyCard: UseAnimation = original
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0317a33944
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Hey - 我在这里给出了一些总体反馈:
IsCollapsed自动属性现在在 setter 中依赖 C# 的field关键字(并移除了_isCollapsed后备字段);请确认项目的 LangVersion 足够高,并且在所有目标上保持一致以支持这种语法,或者为了更广泛的兼容性退回到显式后备字段的写法。- 在
CollapseWithAnimation和ExpandWithAnimation中,高度差值以及对ActualHeight/DesiredSize的假设,在控件处于布局中途或受到约束时(例如嵌套在其他动画或固定高度的容器中)可能会表现异常;建议在ActualHeight <= HeaderHeight时做保护,或者通过更保守的重新测量来避免负值/零长度的动画范围。
面向 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- `IsCollapsed` 自动属性现在在 setter 中依赖 C# 的 `field` 关键字(并移除了 `_isCollapsed` 后备字段);请确认项目的 LangVersion 足够高,并且在所有目标上保持一致以支持这种语法,或者为了更广泛的兼容性退回到显式后备字段的写法。
- 在 `CollapseWithAnimation` 和 `ExpandWithAnimation` 中,高度差值以及对 `ActualHeight`/`DesiredSize` 的假设,在控件处于布局中途或受到约束时(例如嵌套在其他动画或固定高度的容器中)可能会表现异常;建议在 `ActualHeight <= HeaderHeight` 时做保护,或者通过更保守的重新测量来避免负值/零长度的动画范围。帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据这些反馈来改进后续的代码审查。
Original comment in English
Hey - I've left some high level feedback:
- The
IsCollapsedauto-property now relies on the C#fieldkeyword in the setter (and removed the_isCollapsedbacking field); verify the project’s LangVersion is high enough and consistent across targets to support this syntax, or fall back to an explicit backing field for broader compatibility. - In
CollapseWithAnimationandExpandWithAnimation, the height deltas andActualHeight/DesiredSizeassumptions could misbehave if the control is mid-layout or constrained (e.g., inside other animations or fixed-height containers); consider guarding againstActualHeight <= HeaderHeightor re-measuring more defensively to avoid negative/zero animation ranges.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `IsCollapsed` auto-property now relies on the C# `field` keyword in the setter (and removed the `_isCollapsed` backing field); verify the project’s LangVersion is high enough and consistent across targets to support this syntax, or fall back to an explicit backing field for broader compatibility.
- In `CollapseWithAnimation` and `ExpandWithAnimation`, the height deltas and `ActualHeight`/`DesiredSize` assumptions could misbehave if the control is mid-layout or constrained (e.g., inside other animations or fixed-height containers); consider guarding against `ActualHeight <= HeaderHeight` or re-measuring more defensively to avoid negative/zero animation ranges.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b0633951a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary by Sourcery
为 MyCollapseBar 添加基于高度的折叠/展开动画行为,并使其与父级卡片动画的集成更加顺畅。
New Features:
Enhancements:
Original summary in English
Summary by Sourcery
Add animated height-based collapse/expand behavior to MyCollapseBar and integrate it more cleanly with parent card animations.
New Features:
Enhancements: