From c7e9102d56e5725faa9f542d08445b496fbe5211 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 12 Apr 2019 12:29:40 +0800 Subject: [PATCH] Fix frameRate type issue (#4200) * Fix frameRate type issue * Improve adaptation on desktop --- cocos/core/game.js | 6 ++++++ cocos/core/platform/CCView.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cocos/core/game.js b/cocos/core/game.js index ba86e5c6b4..55e07f8fec 100644 --- a/cocos/core/game.js +++ b/cocos/core/game.js @@ -174,6 +174,12 @@ class Game extends EventTarget { */ setFrameRate(frameRate) { var config = this.config; + if (typeof frameRate !== 'number') { + frameRate = parseInt(frameRate); + if (isNaN(frameRate)) { + frameRate = 60; + } + } config.frameRate = frameRate; if (this._intervalId) window.cancelAnimFrame(this._intervalId); diff --git a/cocos/core/platform/CCView.js b/cocos/core/platform/CCView.js index 464dc1349d..8345a41d70 100644 --- a/cocos/core/platform/CCView.js +++ b/cocos/core/platform/CCView.js @@ -1080,7 +1080,7 @@ class ContainerStrategy { var locCanvas = cc.game.canvas, locContainer = cc.game.container; if (cc.sys.platform !== cc.sys.WECHAT_GAME) { - if (cc.sys.os === cc.sys.OS_ANDROID) { + if (cc.sys.os !== cc.sys.OS_IOS) { document.body.style.width = (view._isRotated ? h : w) + 'px'; document.body.style.height = (view._isRotated ? w : h) + 'px'; }