From c39d073ff897da33fb212f60acbe8514fea9c34b Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 30 Dec 2022 15:38:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8=E7=BC=A9?= =?UTF-8?q?=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/main.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/public/main.js b/public/main.js index 7768204..d5fff40 100644 --- a/public/main.js +++ b/public/main.js @@ -278,9 +278,14 @@ main.prototype.init = function (mode, callback) { main.core.init(coreData, callback); main.core.resize(); // 自动放缩最大化 - if (!data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags.autoScale) - core.setLocalStorage('autoScale', false); - else core.setLocalStorage('autoScale', true); + if (core.getLocalStorage('autoScale') == null) { + if ( + !data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags + .autoScale + ) + core.setLocalStorage('autoScale', false); + else core.setLocalStorage('autoScale', true); + } if ( core.getLocalStorage('autoScale') && !core.domStyle.isVertical @@ -306,6 +311,25 @@ main.prototype.init = function (mode, callback) { ); main.core.resize(); } + requestAnimationFrame(function () { + var style = getComputedStyle( + main.dom.gameGroup + ); + var height = parseFloat(style.height); + if (height > window.innerHeight * 0.95) { + main.core.control.setDisplayScale(-1); + if ( + !main.core.isPlaying() && + main.core.flags.enableHDCanvas + ) { + main.core.domStyle.ratio = Math.max( + window.devicePixelRatio || 1, + main.core.domStyle.scale + ); + main.core.resize(); + } + } + }); } } catch (e) { console.error(e);