适配问题

This commit is contained in:
2025-05-28 17:32:13 +08:00
parent 6b54859c98
commit 09979e21e7
2 changed files with 3 additions and 4 deletions

View File

@@ -1,7 +1,8 @@
{
"resolution": {
"designWidth": 1920,
"designHeight": 1080,
"designWidth": 1080,
"designHeight": 1920,
"scaleMode": "fixedauto",
"backgroundColor": "rgba(245, 247, 251, 1)"
},
"modules": {

View File

@@ -7,13 +7,11 @@ Laya.addBeforeInitCallback((stageConfig) => {
if (window.innerWidth > window.innerHeight) {
stageConfig.designWidth = config.DESIGN_HEIGHT
stageConfig.designHeight = config.DESIGN_WIDTH
stageConfig.scaleMode = "fixedauto"
config.H_SCREEN = true
}
else {
stageConfig.designWidth = config.DESIGN_WIDTH
stageConfig.designHeight = config.DESIGN_HEIGHT
stageConfig.scaleMode = "fixedheight"
config.H_SCREEN = false
}
console.log(`横屏=${config.H_SCREEN}`)