Fix frameRate type issue (#4200)

* Fix frameRate type issue

* Improve adaptation on desktop
This commit is contained in:
pandamicro
2019-04-12 12:29:40 +08:00
committed by GitHub
parent 5a0b49ac25
commit c7e9102d56
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -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);
+1 -1
View File
@@ -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';
}