mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 01:12:42 +08:00
Fix frameRate type issue (#4200)
* Fix frameRate type issue * Improve adaptation on desktop
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user