Skip to content

Commit 003dfae

Browse files
authored
Merge pull request #3473 from pandamicro/develop
Improve adaptation logic when iframe wrapped the page on iOS
2 parents bf0908c + c7e689f commit 003dfae

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

CCBoot.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ var _initSys = function () {
17581758
sys.browserVersion = "";
17591759
/* Determine the browser version number */
17601760
(function(){
1761-
var versionReg1 = /(mqqbrowser|micromessenger|sogou|qzone|liebao|maxthon|baidu)(mobile)?(browser)?\/?([\d.]+)/i;
1761+
var versionReg1 = /(mqqbrowser|micromessenger|sogou|qzone|liebao|maxthon|mxbrowser|baidu)(mobile)?(browser)?\/?([\d.]+)/i;
17621762
var versionReg2 = /(msie |rv:|firefox|chrome|ucbrowser|qq|oupeng|opera|opr|safari|miui)(mobile)?(browser)?\/?([\d.]+)/i;
17631763
var tmp = ua.match(versionReg1);
17641764
if(!tmp) tmp = ua.match(versionReg2);

cocos2d/core/platform/CCConfig.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @type {String}
3232
* @name cc.ENGINE_VERSION
3333
*/
34-
window["CocosEngine"] = cc.ENGINE_VERSION = "Cocos2d-JS v3.14";
34+
window["CocosEngine"] = cc.ENGINE_VERSION = "Cocos2d-JS v3.15";
3535

3636
/**
3737
* <p>

cocos2d/core/platform/CCEGLView.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
194194
} else {
195195
view = cc.view;
196196
}
197+
if (view._orientationChanging) {
198+
return;
199+
}
197200

198201
// Check frame size changed or not
199202
var prevFrameW = view._frameSize.width, prevFrameH = view._frameSize.height, prevRotated = view._isRotated;
@@ -229,7 +232,13 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
229232

230233
_orientationChange: function () {
231234
cc.view._orientationChanging = true;
232-
cc.view._resizeEvent();
235+
if (cc.sys.isMobile) {
236+
cc.game.container.style.display = "none";
237+
}
238+
setTimeout(function () {
239+
cc.view._orientationChanging = false;
240+
cc.view._resizeEvent();
241+
}, 300);
233242
},
234243

235244
/**
@@ -348,11 +357,6 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
348357
cc.container.style.transformOrigin = '0px 0px 0px';
349358
this._isRotated = true;
350359
}
351-
if (this._orientationChanging) {
352-
setTimeout(function () {
353-
cc.view._orientationChanging = false;
354-
}, 1000);
355-
}
356360
},
357361

358362
// hack
@@ -676,8 +680,6 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
676680
if (cc.sys.isMobile)
677681
this._adjustViewportMeta();
678682

679-
// Permit to re-detect the orientation of device.
680-
this._orientationChanging = true;
681683
// If resizing, then frame size is already initialized, this logic should be improved
682684
if (!this._resizing)
683685
this._initFrameSize();

tools/build.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
classpath="./compiler/compiler.jar"/>
66
<target name="compile">
77
<jscomp compilationLevel="simple" warning="quiet"
8-
debug="false" output="./../lib/cocos2d-js-v3.14-min.js"
8+
debug="false" output="./../lib/cocos2d-js-v3.15-min.js"
99
languageIn="ECMASCRIPT5"
10-
sourceMapOutputFile="./../lib/cocos2d-js-v3.14-sourcemap" sourceMapFormat="V3">
10+
sourceMapOutputFile="./../lib/cocos2d-js-v3.15-sourcemap" sourceMapFormat="V3">
1111
<sources dir="./../">
1212
<file name="Base64Images.js"/>
1313
<file name="CCBoot.js"/>
@@ -306,9 +306,9 @@
306306

307307
<target name="compile_core">
308308
<jscomp compilationLevel="simple" warning="quiet"
309-
debug="false" output="./../lib/cocos2d-js-v3.14-core-min.js"
309+
debug="false" output="./../lib/cocos2d-js-v3.15-core-min.js"
310310
languageIn="ECMASCRIPT5"
311-
sourceMapOutputFile="./../lib/cocos2d-js-v3.14-core-sourcemap" sourceMapFormat="V3">
311+
sourceMapOutputFile="./../lib/cocos2d-js-v3.15-core-sourcemap" sourceMapFormat="V3">
312312
<sources dir="./../">
313313
<file name="cocos2d/core/utils/CCSimplePool.js"/>
314314
<file name="CCBoot.js"/>

0 commit comments

Comments
 (0)