Просмотр исходного кода

fix: close button uses _lastIjsApi.ui.close() to stop music

Previously closeFullscreen created a NEW IJS API instance, so the
plugin's IJS.ui.close() override was never called. Now it uses the
stored _lastIjsApi reference to properly invoke cleanup (music, canvas).

Co-Authored-By: Claude <noreply@anthropic.com>
nonvioce 3 месяцев назад
Родитель
Сommit
779cc52c51
1 измененных файлов с 8 добавлено и 3 удалено
  1. 8 3
      app/src/main/assets/console.js

+ 8 - 3
app/src/main/assets/console.js

@@ -88,9 +88,14 @@ class SymjaConsole {
         document.getElementById('closeFullscreen')?.addEventListener('click', () => {
             const fs = document.getElementById('fullscreenPanel');
             fs.classList.remove('show');
-            // 停止动画循环
-            const api = this.createIJSAPI([]);
-            if (api) api.canvas.stop();
+            // 调用插件的 IJS.ui.close() 进行清理(停止音乐、动画等)
+            if (this._lastIjsApi && this._lastIjsApi.ui) {
+                this._lastIjsApi.ui.close();
+            }
+            // 确保动画停止
+            if (this._lastIjsApi && this._lastIjsApi.canvas) {
+                this._lastIjsApi.canvas.stop();
+            }
         });
 
         // 插件面板事件