Skip to content

fix(tooltip): 切换控件时关闭弹窗再重开以重新定位到新位置#3344

Open
LuLu-ling wants to merge 1 commit into
devfrom
fix/tooltip-reposition
Open

fix(tooltip): 切换控件时关闭弹窗再重开以重新定位到新位置#3344
LuLu-ling wants to merge 1 commit into
devfrom
fix/tooltip-reposition

Conversation

@LuLu-ling

@LuLu-ling LuLu-ling commented Jul 5, 2026

Copy link
Copy Markdown
Member

Summary by Sourcery

Bug Fixes:

  • 确保在切换目标时关闭并重新打开工具提示弹出窗口,以便其能够正确重新定位。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure tooltip flyout is closed and reopened when switching targets so it repositions correctly.

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

sourcery-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor
审阅者指南(在小型 PR 上折叠显示)

审阅者指南

此 PR 更新了提示工具(tooltip)关闭动画的流程:在切换目标控件时,先明确关闭当前的飞出层(flyout),再重新打开,以确保它能正确地重新定位到新的目标控件上。

更新后的提示工具飞出层重新定位时序图

sequenceDiagram
    participant Tooltip
    participant target as FrameworkElement_target
    participant shell as Shell_shell
    participant sb as Storyboard_closeStoryClone
    participant flyout as Flyout_flyout

    Tooltip->>Tooltip: _StartCycle(target, pt)
    Tooltip->>Tooltip: _closeStory.Clone()
    Tooltip->>shell: BeginStoryboard(sb)
    sb-->>Tooltip: Completed
    alt [mark == _gen]
        Tooltip->>flyout: IsOpen = false
        Tooltip->>Tooltip: _PopUp(target, pt)
    end
Loading

文件级变更

变更 详情 文件
确保在循环到新的目标控件时,提示工具的飞出层在重新打开前被显式关闭,从而能够正确地重新定位。
  • 像之前一样克隆关闭 storyboard,并附加 Completed 处理程序。
  • 在 Completed 处理程序中,当生成标记匹配时,在调用弹出例程之前,显式将飞出层的 IsOpen 属性设置为 false。
  • 保留对生成标记的保护,以避免对过期的周期执行操作,并在完成后仍然从 shell 中移除 storyboard。
PCL.Core/UI/Controls/Tooltip.cs

可能关联的问题

  • #C#:此 PR 在控件切换时强制提示工具关闭并重新打开,修复了位置错位的问题,让它不再被遮挡。

技巧与命令

与 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

This PR updates the tooltip closing animation flow so that when switching target controls, the existing flyout is explicitly closed before reopening, ensuring it repositions correctly to the new target.

Sequence diagram for updated tooltip flyout repositioning

sequenceDiagram
    participant Tooltip
    participant target as FrameworkElement_target
    participant shell as Shell_shell
    participant sb as Storyboard_closeStoryClone
    participant flyout as Flyout_flyout

    Tooltip->>Tooltip: _StartCycle(target, pt)
    Tooltip->>Tooltip: _closeStory.Clone()
    Tooltip->>shell: BeginStoryboard(sb)
    sb-->>Tooltip: Completed
    alt [mark == _gen]
        Tooltip->>flyout: IsOpen = false
        Tooltip->>Tooltip: _PopUp(target, pt)
    end
Loading

File-Level Changes

Change Details Files
Ensure tooltip flyout is explicitly closed before reopening when cycling to a new target control so it repositions properly.
  • Clone the close storyboard and attach a Completed handler as before.
  • Within the Completed handler, when the generation mark matches, explicitly set the flyout’s IsOpen property to false before calling the popup routine.
  • Keep the guard on the generation mark to avoid acting on stale cycles and still remove the storyboard from the shell after completion.
PCL.Core/UI/Controls/Tooltip.cs

Possibly linked issues

  • #C#: The PR forces tooltip to close and reopen on control switch, fixing misposition so it’s no longer blocked.

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
Contributor

Choose a reason for hiding this comment

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

Hey - 我给出了几条总体反馈:

  • 在访问 _flyoutIsOpen 属性之前,考虑先对 _flyout 进行空值检查,以避免在某些路径中 _flyout 尚未初始化时出现潜在的空引用问题。
  • Completed 处理程序中显式关闭 _flyout 可能会触发额外的事件或副作用;请确认是否需要加上保护条件,以避免在 IsOpen 已经为 false 时产生不必要的关闭/重新打开循环。
供 AI 代理使用的提示
Please address the comments from this code review:

## Overall Comments
- 在访问 `_flyout``IsOpen` 属性之前,考虑先对 `_flyout` 进行空值检查,以避免在某些路径中 `_flyout` 尚未初始化时出现潜在的空引用问题。
-`Completed` 处理程序中显式关闭 `_flyout` 可能会触发额外的事件或副作用;请确认是否需要加上保护条件,以避免在 `IsOpen` 已经为 false 时产生不必要的关闭/重新打开循环。

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

Hey - I've left some high level feedback:

  • Consider adding a null-check around _flyout before accessing IsOpen to prevent potential null reference issues if _flyout is not initialized in some paths.
  • Explicitly closing _flyout in the Completed handler may trigger additional events or side effects; verify whether this should be guarded to avoid unnecessary close/open cycles when IsOpen is already false.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding a null-check around `_flyout` before accessing `IsOpen` to prevent potential null reference issues if `_flyout` is not initialized in some paths.
- Explicitly closing `_flyout` in the `Completed` handler may trigger additional events or side effects; verify whether this should be guarded to avoid unnecessary close/open cycles when `IsOpen` is already false.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XS PR 大小评估:微型 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant