feat: 手机APP强制横屏

This commit is contained in:
AncTe committed 2024-04-19 22:48:41 +08:00
1 parent 9463891af2
commit 7c8b179104
3 files changed
+20 -2

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@
## V2.A
[x] 自定义工具的大小问题
[] 优化 ui 布局
[x] 优化 ui 布局
[] 设置条目中添加 switch 开关
## V2.A.1
+5 -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
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;
}
/**
* 移动的方向
*/