Skip to content

fix(ui): 修复 MyListItem 选中时动画条的高度问题#2874

Merged
LinQingYuu merged 2 commits into
PCL-Community:devfrom
MinecraftYJQ:dev
May 23, 2026
Merged

fix(ui): 修复 MyListItem 选中时动画条的高度问题#2874
LinQingYuu merged 2 commits into
PCL-Community:devfrom
MinecraftYJQ:dev

Conversation

@MinecraftYJQ
Copy link
Copy Markdown
Member

@MinecraftYJQ MinecraftYJQ commented May 22, 2026

image image

让他的高度能够固定。在旧版,默认的高度和选中的高度不一致

Summary by Sourcery

修复并统一 MyListItem 选中指示条的视觉行为,确保其具有一致的固定高度,并提供更流畅的显示/隐藏动画。

Bug 修复:

  • 确保 MyListItem 左侧选中指示条在正常和选中状态之间保持一致的固定高度。

增强优化:

  • 通过切换为居中的缩放变换来改进选中指示条的动画效果,从而获得更平滑的展开/收起动画以及更一致的对齐方式。
Original summary in English

Summary by Sourcery

Fix and standardize the visual behavior of the MyListItem selection indicator bar, ensuring a consistent fixed height and smoother show/hide animation.

Bug Fixes:

  • Ensure the MyListItem left selection indicator keeps a consistent fixed height between normal and selected states.

Enhancements:

  • Improve the selection indicator animation by switching to a centered scale transform for smoother expand/collapse effects and consistent alignment.

@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: M PR 大小评估:中型 labels May 22, 2026
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 22, 2026

审阅者指南

此 PR 通过用基于缩放变换的动画替换基于高度的动画,并在所有选中/未选中状态下为左侧“神秘”选择条设置固定且居中的高度,修复了 MyListItem 中左侧选择条视觉高度不一致的问题。

文件级变更

变更 细节 文件
当切换选中状态时,统一 MyListItem 中左侧选择条的视觉高度和动画行为。
  • 引入一个可配置常量(customHeight = 20d),并将其作为选择条的固定高度,而不是依赖动态/自动高度和基于 ActualHeight 的动画。
  • 将 RectCheck 上原先改变高度的动画替换为基于 ScaleTransform 的 ScaleY 动画(选中时 0→1,取消选中时从当前值→0),同时将 RenderTransformOrigin 设置为中心以保证缩放的一致性。
  • 在选中状态下(固定高度、垂直居中对齐、上下边距为 0、不透明度为 1)和未选中状态下(高度为 0、不透明度为 0、居中、清除变换)规范 RectCheck 的静态布局属性,以消除视觉高度差异。
  • 简化并现代化 RectCheck 的空值检查(使用 RectCheck != null),并在需要进行动画之前确保 RenderTransform 已初始化为 ScaleTransform。
Plain Craft Launcher 2/Controls/MyListItem.xaml.cs

提示与命令

与 Sourcery 交互

  • 触发新的审阅: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 在审阅评论下回复,请求 Sourcery 从该评论创建一个 issue。你也可以直接在审阅评论下回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文的任意位置写入 @sourcery-ai summary,即可在你想要的位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来在任意时间(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 中评论 @sourcery-ai guide,即可在任意时间(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 关闭所有 Sourcery 审阅: 在 pull request 中评论 @sourcery-ai dismiss,即可关闭所有现有的 Sourcery 审阅。特别适用于你想从头开始一个新的审阅时——别忘了再评论 @sourcery-ai review 来触发新的审阅!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用审阅功能,例如 Sourcery 生成的 pull request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide

This PR fixes the visual height inconsistency of the left "mystery" selection bar in MyListItem by replacing height-based animations with scale-transform based animations and enforcing a fixed, centered height for the bar in all checked/unchecked states.

File-Level Changes

Change Details Files
Unify the visual height and animation behavior of the left selection bar in MyListItem when toggling checked state.
  • Introduce a configurable constant (customHeight = 20d) and use it as the fixed height for the selection bar instead of relying on dynamic/auto height and ActualHeight-based animations.
  • Replace previous height-changing animations on RectCheck with ScaleTransform-based animations on ScaleY (0→1 on check, current→0 on uncheck) while setting RenderTransformOrigin to the center for consistent scaling.
  • Normalize RectCheck static layout properties in the checked state (fixed height, center vertical alignment, zero top/bottom margin, full opacity) and in the unchecked state (height 0, opacity 0, centered, cleared transform) to remove the visual height discrepancy.
  • Simplify and modernize null checks on RectCheck (using RectCheck != null) and ensure RenderTransform is initialized to a ScaleTransform when needed before animating.
Plain Craft Launcher 2/Controls/MyListItem.xaml.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出了一些总体反馈:

  • 新的动画逻辑会无条件地将 RectCheck.RenderTransform 覆盖为一个 ScaleTransform(之后再将其重置为 null),这可能会与其他期望使用不同变换的调用方产生冲突;建议考虑在现有变换的基础上进行组合,或者在替换前先保存之前的变换并在结束后恢复,而不是直接替换。
  • customHeight、持续时间数值(例如 30012070)以及缓动函数的选择目前在多个位置被硬编码;建议将这些提取为具名常量或共享配置,这样可以更容易地调整动画行为并保持一致性。
面向 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- The new animation logic unconditionally overwrites `RectCheck.RenderTransform` with a `ScaleTransform` (and later resets it to `null`), which may conflict with other callers that expect a different transform; consider composing with an existing transform or storing and restoring the previous transform instead of replacing it.
- The `customHeight`, duration values (e.g. `300`, `120`, `70`), and easing choices are currently hard-coded in multiple places; extracting these into named constants or a shared configuration would make the animation behavior easier to tweak and keep consistent.

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • The new animation logic unconditionally overwrites RectCheck.RenderTransform with a ScaleTransform (and later resets it to null), which may conflict with other callers that expect a different transform; consider composing with an existing transform or storing and restoring the previous transform instead of replacing it.
  • The customHeight, duration values (e.g. 300, 120, 70), and easing choices are currently hard-coded in multiple places; extracting these into named constants or a shared configuration would make the animation behavior easier to tweak and keep consistent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new animation logic unconditionally overwrites `RectCheck.RenderTransform` with a `ScaleTransform` (and later resets it to `null`), which may conflict with other callers that expect a different transform; consider composing with an existing transform or storing and restoring the previous transform instead of replacing it.
- The `customHeight`, duration values (e.g. `300`, `120`, `70`), and easing choices are currently hard-coded in multiple places; extracting these into named constants or a shared configuration would make the animation behavior easier to tweak and keep consistent.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread Plain Craft Launcher 2/Controls/MyListItem.xaml.cs Outdated
Comment thread Plain Craft Launcher 2/Controls/MyListItem.xaml.cs Outdated
Comment thread Plain Craft Launcher 2/Controls/MyListItem.xaml.cs
@pcl-ce-automation pcl-ce-automation Bot added 🕑 等待合并 已处理完毕,正在等待代码合并入主分支 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels May 23, 2026
@LinQingYuu LinQingYuu merged commit 64a9072 into PCL-Community:dev May 23, 2026
3 checks passed
@pcl-ce-automation pcl-ce-automation Bot added 👌 完成 相关问题已修复或功能已实现,计划在下次版本更新时正式上线 and removed 🕑 等待合并 已处理完毕,正在等待代码合并入主分支 labels May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: M PR 大小评估:中型 👌 完成 相关问题已修复或功能已实现,计划在下次版本更新时正式上线

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants