修复 H5 缩放等动画不播放:大厅 Web 首次显示补 onActive()

ArkWeb 文档:onInactive 态会暂停"可安全暂停的内容,例如动画"(CSS 动画/rAF),onActive 恢复。
本工程 controller.onActive() 原仅在从子游戏返回(activate)时调,**首次进大厅从未调用**,
大厅 Web 处于未激活态 → CSS transform/keyframes 动画与 requestAnimationFrame 被暂停,
表现为"画面在、但缩放等动画卡住不播放"。

修复:WebSlot 增 notifyShown()(调 controller.onActive(),幂等),在 setup() 激活槽建好即调,
并在 BridgeGameContainer 的 NavDestination.onShown 调用(首次进大厅 + 从通用网页返回均覆盖)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
lanterngamescn
2026-06-26 21:19:33 +08:00
co-authored by Claude Opus 4.8
parent 5b9cfedb53
commit d16c7259b4
2 changed files with 19 additions and 0 deletions
@@ -254,6 +254,8 @@ export struct BridgeGameContainer {
.width('100%').height('100%')
}
.hideTitleBar(true)
// 页面(重新)可见时激活当前槽的 Web 引擎,恢复 CSS 动画/rAF(首次进大厅 + 从通用网页返回)
.onShown(() => this.activeSlot()?.notifyShown())
.onBackPressed(() => {
// 分享面板打开时,返回键关闭面板并按取消回投(对齐 Android 点空白关闭)
if (this.sharePanelVisible) {