Skip to content

fix(scene): tell the frame again where the middle of the window is once the layout has followed a resize - #89

Merged
Yundi339 merged 1 commit into
mainfrom
fix/modal-frame-retell-after-layout
Nov 27, 2026
Merged

Yundi339 merged 1 commit into
mainfrom
fix/modal-frame-retell-after-layout

Conversation

@Yundi339

Copy link
Copy Markdown
Member

说明

嵌入面板 iframe 的页面里,居中弹窗靠面板下发的偏移量站在整个窗口的中间,宽度也按它收窄。偏移量此前只在弹窗打开时和 window 的 resize 事件里计算,而 resize 事件先于 ResizeObserver 更新尺寸,窗口一次性变化(贴边、最大化、还原)时偏移量差一整步,弹窗被平移到错误位置、宽度按旧尺寸收窄,内容被裁切;观察器更新尺寸后也不会再下发。再调整一次窗口才恢复。

修改

  • MScene 在尺寸、侧栏宽度、侧栏状态、底栏模式变化且布局完成后,若有弹窗打开就重新测量并下发偏移量。同时覆盖此前根本不会重算的情况:侧栏折叠展开、窄窗口下侧栏切换为底栏
  • modalbridge 测试新增守卫,弹窗相关 10 项测试通过
  • foundation-panel 与 foundation-sunshine 升级各自的 pin 后生效

…ce the layout has followed a resize

The offset of a centred dialog of a framed page (MODAL_FRAME) was told in
the window's resize event, which runs before the size observer has the new
size: a window snapped, maximised or restored in one step moved the dialog
by the offset of the previous size and narrowed it by the same stale
number, and nothing told again. It is now told again after the layout that
depends on the size, the rail and the bar has been made.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 问题修复
    • 模态框打开期间,窗口尺寸或页面布局变化后会重新测量嵌入内容,并更新其居中位置。
    • 保留窗口大小变化时的布局更新行为。

当模态框打开时,场景尺寸或导航布局状态变化后,MScene.vue 会在 DOM 更新后重新测量 iframe 并发送居中偏移。新增测试检查布局监听和更新行为。

Changes: 模态框布局更新

Layer / File(s) Summary
布局监听与 iframe 更新
src/vue/MScene.vue, test/modalbridge.test.js
MScene.vue 新增 post-flush 布局监听。指定布局状态变化且模态框打开时,重新测量 iframe 并调用 tellFrame。测试检查监听器和相关调用。

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: skyhua0224

Merge Risk: Minimal · up to 9f266

This change remeasures and resends the modal offset after layout changes, so embedded modals stay centered after window snapping, maximizing, or restoring. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题描述了 MScene 在窗口尺寸变化后重新向 iframe 下发居中偏移量的修复,与变更内容一致。标题较长(19 个词),但主要改动清楚。
Description check Passed 描述说明了问题背景(resize 事件先于 ResizeObserver 更新尺寸导致偏移量错误)、MScene 的修改范围以及测试新增内容,与变更高度相关。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

小兔捧来一把尺,
等到布局更新时,
量量窗框新位置,
轻轻送去居中值。
模态框里春风至。

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 20f38782-bd68-4751-bdc4-71fbd5212524
Commits

Reviewing files that changed from the base of the PR and between 830ae35 and 9f266f2.

Files selected for processing: 2

  • src/vue/MScene.vue
  • test/modalbridge.test.js

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@Yundi339
Yundi339 merged commit 08818c9 into main Nov 27, 2026
7 checks 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.

1 participant