Skip to content

fix(mod-main): update visual properties of hints on alignment change#3157

Closed
LuLu-ling wants to merge 2 commits into
devfrom
fix/fking-hint-bug
Closed

fix(mod-main): update visual properties of hints on alignment change#3157
LuLu-ling wants to merge 2 commits into
devfrom
fix/fking-hint-bug

Conversation

@LuLu-ling

@LuLu-ling LuLu-ling commented Jun 16, 2026

Copy link
Copy Markdown
Member

Generated by deepseek-v4-pro

Summary by Sourcery

增强:

  • 当当前对齐方向发生变化时,使可见提示的圆角半径、对齐方式和边距与新的对齐方向保持同步。
Original summary in English

Summary by Sourcery

Enhancements:

  • Synchronize corner radius, alignment, and margins of visible hints with the current alignment direction when it changes.

@LuLu-ling LuLu-ling requested a review from a team June 16, 2026 09:01
@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: XS PR 大小评估:微型 labels Jun 16, 2026
@sourcery-ai

sourcery-ai Bot commented Jun 16, 2026

Copy link
Copy Markdown
审阅者指南(在小型 PR 中折叠)

审阅者指南

通过在运行显示动画之前调整边框、对齐和边距属性,使现有提示(hint)UI 元素在对齐方式发生变化时能够立即反映变化。

HintTick 中更新提示对齐处理的时序图

sequenceDiagram
    participant HintTick
    participant ModAnimation
    participant doubleStack
    participant textBlock

    HintTick->>ModAnimation: AniIsRun(Hint_Show_id)
    alt [AniIsRun returns false]
        HintTick->>ModAnimation: AniStop(Hint_Hide_id)
        HintTick->>doubleStack: set CornerRadius (based on alignRight)
        HintTick->>doubleStack: set HorizontalAlignment (based on alignRight)
        HintTick->>doubleStack: set Margin (based on alignRight)
        HintTick->>doubleStack: access Child
        alt [Child is TextBlock]
            HintTick->>textBlock: set Margin (based on alignRight)
        end
        HintTick->>ModAnimation: AniStart(animations)
    end
Loading

文件级变更

变更 详情 文件
在触发显示动画之前,当对齐侧发生变化时,更新现有提示的视觉属性。
  • 在更新属性之前,先停止当前目标提示上正在运行的隐藏动画。
  • 根据提示应右对齐还是左对齐,重新计算并应用 CornerRadius。
  • 更新 HorizontalAlignment 和外层 Margin,以在正确的一侧定位提示并设置合适的偏移。
  • 有条件地调整内部 TextBlock 的边距,以确保在左、右对齐两种情况下文本内边距和图标间距都正确。
Plain Craft Launcher 2/Modules/ModMain.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 (collapsed on small PRs)

Reviewer's Guide

Updates existing hint UI elements to immediately reflect alignment changes by adjusting border, alignment, and margin properties before running the show animation.

Sequence diagram for updated hint alignment handling in HintTick

sequenceDiagram
    participant HintTick
    participant ModAnimation
    participant doubleStack
    participant textBlock

    HintTick->>ModAnimation: AniIsRun(Hint_Show_id)
    alt [AniIsRun returns false]
        HintTick->>ModAnimation: AniStop(Hint_Hide_id)
        HintTick->>doubleStack: set CornerRadius (based on alignRight)
        HintTick->>doubleStack: set HorizontalAlignment (based on alignRight)
        HintTick->>doubleStack: set Margin (based on alignRight)
        HintTick->>doubleStack: access Child
        alt [Child is TextBlock]
            HintTick->>textBlock: set Margin (based on alignRight)
        end
        HintTick->>ModAnimation: AniStart(animations)
    end
Loading

File-Level Changes

Change Details Files
Update visual properties of existing hints when the alignment side changes before triggering the show animation.
  • Stop any running hide animation for the currently targeted hint before updating its properties.
  • Recalculate and apply CornerRadius based on whether hints should align to the right or left.
  • Update HorizontalAlignment and outer Margin to position the hint on the correct side with proper offset.
  • Adjust inner TextBlock margin conditionally so text padding and icon spacing are correct for both left and right alignments.
Plain Craft Launcher 2/Modules/ModMain.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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - 我给出了一些整体性的反馈:

  • 针对 doubleStack 的、依赖对齐方式的视觉设置(圆角、水平对齐、外边距,以及子 TextBlock 的外边距)现在出现了重复逻辑;建议将这部分提取到一个辅助方法中,这样对齐方式的变更和初始设置就可以共享同一个“单一事实来源”。
  • 硬编码的外边距和圆角值(20d-70d33d 等)会让布局难以微调;建议将这些值定义为具名常量,或复用已有的样式资源,以更清晰地表达其意图,并简化后续的调整。
给 AI 代理的提示词
Please address the comments from this code review:

## Overall Comments
- The alignment-dependent visual setup for `doubleStack` (corner radius, horizontal alignment, margins, and child `TextBlock` margin) is now duplicated logic; consider extracting this into a helper method so that alignment changes and initial setup share a single source of truth.
- The hardcoded margin and corner radius values (`20d`, `-70d`, `33d`, etc.) make the layout harder to tune; consider defining these as named constants or reusing existing style resources to clarify their intent and simplify future adjustments.

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

Hey - I've left some high level feedback:

  • The alignment-dependent visual setup for doubleStack (corner radius, horizontal alignment, margins, and child TextBlock margin) is now duplicated logic; consider extracting this into a helper method so that alignment changes and initial setup share a single source of truth.
  • The hardcoded margin and corner radius values (20d, -70d, 33d, etc.) make the layout harder to tune; consider defining these as named constants or reusing existing style resources to clarify their intent and simplify future adjustments.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The alignment-dependent visual setup for `doubleStack` (corner radius, horizontal alignment, margins, and child `TextBlock` margin) is now duplicated logic; consider extracting this into a helper method so that alignment changes and initial setup share a single source of truth.
- The hardcoded margin and corner radius values (`20d`, `-70d`, `33d`, etc.) make the layout harder to tune; consider defining these as named constants or reusing existing style resources to clarify their intent and simplify future adjustments.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71dcb5d97c

ℹ️ 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".

Comment thread Plain Craft Launcher 2/Modules/ModMain.cs Outdated
@pcl-ce-automation pcl-ce-automation Bot added size: S PR 大小评估:小型 and removed size: XS PR 大小评估:微型 labels Jun 16, 2026
@LuLu-ling

Copy link
Copy Markdown
Member Author

由于有了 #3160 ,此 PR 已经不再需要

@LuLu-ling LuLu-ling closed this Jun 16, 2026
@pcl-ce-automation pcl-ce-automation Bot removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: S PR 大小评估:小型 labels Jun 16, 2026
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