diff --git a/idea.md b/idea.md index eea01dc..dfc21da 100644 --- a/idea.md +++ b/idea.md @@ -34,7 +34,7 @@ ## V2.A [x] 自定义工具的大小问题 -[] 优化 ui 布局 +[x] 优化 ui 布局 [] 设置条目中添加 switch 开关 ## V2.A.1 diff --git a/src/plugin/utils.ts b/src/plugin/utils.ts index 21110c0..4e8cea6 100644 --- a/src/plugin/utils.ts +++ b/src/plugin/utils.ts @@ -274,7 +274,11 @@ export async function triggerFullscreen(full: boolean) { if (!Mota.Plugin.inited) return; const { maxGameScale } = Mota.Plugin.require('utils_g'); if (!!document.fullscreenElement && !full) { - await document.exitFullscreen(); + if (window.jsinterface) { + window.jsinterface.requireLandscape?.(); + } else { + await document.exitFullscreen(); + } requestAnimationFrame(() => { maxGameScale(1); }); diff --git a/src/types/util.d.ts b/src/types/util.d.ts index 9f6a046..cf2f5ce 100644 --- a/src/types/util.d.ts +++ b/src/types/util.d.ts @@ -547,6 +547,20 @@ interface Utils { declare const utils: new () => Utils; +/** + * APP接口,使用前应先判断是否存在 + */ +interface JSInterface { + /** 强制横屏 */ + requireLandscape(): void; +} + +declare const jsinterface: JSInterface; + +interface Window { + readonly jsinterface: JSInterface; +} + /** * 移动的方向 */