feat: 手机APP强制横屏

This commit is contained in:
unanmed 2024-04-19 22:48:41 +08:00
parent 9463891af2
commit 7c8b179104
3 changed files with 20 additions and 2 deletions

View File

@ -34,7 +34,7 @@
## V2.A
[x] 自定义工具的大小问题
[] 优化 ui 布局
[x] 优化 ui 布局
[] 设置条目中添加 switch 开关
## V2.A.1

View File

@ -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);
});

14
src/types/util.d.ts vendored
View File

@ -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;
}
/**
*
*/