Skip to content

Improve adaptation logic when iframe wrapped the page on iOS #3473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CCBoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ var _initSys = function () {
sys.browserVersion = "";
/* Determine the browser version number */
(function(){
var versionReg1 = /(mqqbrowser|micromessenger|sogou|qzone|liebao|maxthon|baidu)(mobile)?(browser)?\/?([\d.]+)/i;
var versionReg1 = /(mqqbrowser|micromessenger|sogou|qzone|liebao|maxthon|mxbrowser|baidu)(mobile)?(browser)?\/?([\d.]+)/i;
var versionReg2 = /(msie |rv:|firefox|chrome|ucbrowser|qq|oupeng|opera|opr|safari|miui)(mobile)?(browser)?\/?([\d.]+)/i;
var tmp = ua.match(versionReg1);
if(!tmp) tmp = ua.match(versionReg2);
Expand Down
2 changes: 1 addition & 1 deletion cocos2d/core/platform/CCConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @type {String}
* @name cc.ENGINE_VERSION
*/
window["CocosEngine"] = cc.ENGINE_VERSION = "Cocos2d-JS v3.14";
window["CocosEngine"] = cc.ENGINE_VERSION = "Cocos2d-JS v3.15";

/**
* <p>
Expand Down
18 changes: 10 additions & 8 deletions cocos2d/core/platform/CCEGLView.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
} else {
view = cc.view;
}
if (view._orientationChanging) {
return;
}

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

_orientationChange: function () {
cc.view._orientationChanging = true;
cc.view._resizeEvent();
if (cc.sys.isMobile) {
cc.game.container.style.display = "none";
}
setTimeout(function () {
cc.view._orientationChanging = false;
cc.view._resizeEvent();
}, 300);
},

/**
Expand Down Expand Up @@ -348,11 +357,6 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
cc.container.style.transformOrigin = '0px 0px 0px';
this._isRotated = true;
}
if (this._orientationChanging) {
setTimeout(function () {
cc.view._orientationChanging = false;
}, 1000);
}
},

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

// Permit to re-detect the orientation of device.
this._orientationChanging = true;
// If resizing, then frame size is already initialized, this logic should be improved
if (!this._resizing)
this._initFrameSize();
Expand Down
8 changes: 4 additions & 4 deletions tools/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
classpath="./compiler/compiler.jar"/>
<target name="compile">
<jscomp compilationLevel="simple" warning="quiet"
debug="false" output="./../lib/cocos2d-js-v3.14-min.js"
debug="false" output="./../lib/cocos2d-js-v3.15-min.js"
languageIn="ECMASCRIPT5"
sourceMapOutputFile="./../lib/cocos2d-js-v3.14-sourcemap" sourceMapFormat="V3">
sourceMapOutputFile="./../lib/cocos2d-js-v3.15-sourcemap" sourceMapFormat="V3">
<sources dir="./../">
<file name="Base64Images.js"/>
<file name="CCBoot.js"/>
Expand Down Expand Up @@ -306,9 +306,9 @@

<target name="compile_core">
<jscomp compilationLevel="simple" warning="quiet"
debug="false" output="./../lib/cocos2d-js-v3.14-core-min.js"
debug="false" output="./../lib/cocos2d-js-v3.15-core-min.js"
languageIn="ECMASCRIPT5"
sourceMapOutputFile="./../lib/cocos2d-js-v3.14-core-sourcemap" sourceMapFormat="V3">
sourceMapOutputFile="./../lib/cocos2d-js-v3.15-core-sourcemap" sourceMapFormat="V3">
<sources dir="./../">
<file name="cocos2d/core/utils/CCSimplePool.js"/>
<file name="CCBoot.js"/>
Expand Down