fix: 全屏按钮增加横屏锁定
点击全屏按钮后:进入浏览器全屏 + 锁定横屏方向 退出全屏时:解除横屏锁定 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -214,16 +214,20 @@ export default function MonitoringView() {
|
||||
|
||||
const filteredVehicles = vehicles;
|
||||
|
||||
const toggleFullscreen = () => {
|
||||
const toggleFullscreen = async () => {
|
||||
if (!isFullscreen) {
|
||||
const elem = document.documentElement;
|
||||
if (elem.requestFullscreen) {
|
||||
elem.requestFullscreen().catch(() => {});
|
||||
}
|
||||
try {
|
||||
const elem = document.documentElement;
|
||||
if (elem.requestFullscreen) await elem.requestFullscreen();
|
||||
// 尝试锁定横屏
|
||||
try { await (screen.orientation as any).lock('landscape'); } catch {}
|
||||
} catch {}
|
||||
} else {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen().catch(() => {});
|
||||
}
|
||||
try {
|
||||
// 解除横屏锁定
|
||||
try { (screen.orientation as any).unlock(); } catch {}
|
||||
if (document.exitFullscreen) await document.exitFullscreen();
|
||||
} catch {}
|
||||
}
|
||||
setIsFullscreen(!isFullscreen);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user