Skip to content

保持弹窗打开时的位置稳定 - #22

Merged
TNT-Likely merged 1 commit into
TNT-Likely:mainfrom
1254455745:review/popover-anchor-v2
Jun 4, 2026
Merged

保持弹窗打开时的位置稳定#22
TNT-Likely merged 1 commit into
TNT-Likely:mainfrom
1254455745:review/popover-anchor-v2

Conversation

@1254455745

Copy link
Copy Markdown
Contributor

这个 PR 调整菜单栏弹窗的锚点逻辑,避免菜单栏内容宽度变化时弹窗左右跳动。

改动内容:

  • 弹窗打开时锁定本次状态栏项目宽度。
  • 菜单栏内容切换期间,弹窗位置保持稳定。
  • 弹窗关闭后恢复正常宽度更新逻辑。

验证:

  • 单独分支构建通过。

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — locks NSStatusItem length while the popover is open so the anchor position stays stable when ticker content width changes. Also tightens NotificationCenter observer lifecycle in PopoverController.

  • Lock popover anchor widthStatusItemController.lockedPopoverLength overrides tickerView.totalWidth in all sizing paths while non-nil, set before showing the popover and cleared on close.
  • Popover close callbackPopoverController.onClose wired to unlockPopoverLength(), ensuring the width lock is released regardless of how the popover closes (.transient behavior, programmatic close, or outside-click).
  • Observer lifecycle fixdidCloseObserver correctly stores the block-based observer token for targeted removal in deinit; previous removeObserver(self) was a no-op for block-based observers.
  • MainActor safetyhandlePopoverClosed wrapped in Task { @MainActor } in the notification callback, guarding against non-main-thread delivery.

Pullfrog  | View workflow run | Using DeepSeek Flash𝕏

@TNT-Likely
TNT-Likely merged commit 6503d57 into TNT-Likely:main Jun 4, 2026
1 check passed
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.

2 participants