mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-19 17:16:08 +08:00
feat: 手机APP强制横屏
This commit is contained in:
parent
9463891af2
commit
7c8b179104
2
idea.md
2
idea.md
@ -34,7 +34,7 @@
|
|||||||
## V2.A
|
## V2.A
|
||||||
|
|
||||||
[x] 自定义工具的大小问题
|
[x] 自定义工具的大小问题
|
||||||
[] 优化 ui 布局
|
[x] 优化 ui 布局
|
||||||
[] 设置条目中添加 switch 开关
|
[] 设置条目中添加 switch 开关
|
||||||
|
|
||||||
## V2.A.1
|
## V2.A.1
|
||||||
|
@ -274,7 +274,11 @@ export async function triggerFullscreen(full: boolean) {
|
|||||||
if (!Mota.Plugin.inited) return;
|
if (!Mota.Plugin.inited) return;
|
||||||
const { maxGameScale } = Mota.Plugin.require('utils_g');
|
const { maxGameScale } = Mota.Plugin.require('utils_g');
|
||||||
if (!!document.fullscreenElement && !full) {
|
if (!!document.fullscreenElement && !full) {
|
||||||
await document.exitFullscreen();
|
if (window.jsinterface) {
|
||||||
|
window.jsinterface.requireLandscape?.();
|
||||||
|
} else {
|
||||||
|
await document.exitFullscreen();
|
||||||
|
}
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
maxGameScale(1);
|
maxGameScale(1);
|
||||||
});
|
});
|
||||||
|
14
src/types/util.d.ts
vendored
14
src/types/util.d.ts
vendored
@ -547,6 +547,20 @@ interface Utils {
|
|||||||
|
|
||||||
declare const utils: new () => Utils;
|
declare const utils: new () => Utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP接口,使用前应先判断是否存在
|
||||||
|
*/
|
||||||
|
interface JSInterface {
|
||||||
|
/** 强制横屏 */
|
||||||
|
requireLandscape(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const jsinterface: JSInterface;
|
||||||
|
|
||||||
|
interface Window {
|
||||||
|
readonly jsinterface: JSInterface;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移动的方向
|
* 移动的方向
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user