diff --git a/cocos2d/core/platform/CCEGLView.js b/cocos2d/core/platform/CCEGLView.js index 562acc5e0e..6f15281684 100644 --- a/cocos2d/core/platform/CCEGLView.js +++ b/cocos2d/core/platform/CCEGLView.js @@ -174,8 +174,20 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{ _initFrameSize: function () { var locFrameSize = this._frameSize; - locFrameSize.width = this._frame.clientWidth; - locFrameSize.height = this._frame.clientHeight; + //To get the most likely for the actual display resolution data + var sWidth = Math.min(window.screen.availWidth, window.screen.width) * window.devicePixelRatio; + var sHeight = Math.min(window.screen.availHeight, window.screen.height) * window.devicePixelRatio; + //Calibration of the actual resolution may be smaller + if(cc.sys.isMobile && this._frame.clientWidth >= sWidth * 0.8){ + locFrameSize.width = sWidth / window.devicePixelRatio; + }else{ + locFrameSize.width = this._frame.clientWidth; + } + if(cc.sys.isMobile && this._frame.clientWidth >= sHeight * 0.8){ + locFrameSize.height = sHeight / window.devicePixelRatio; + }else{ + locFrameSize.height = this._frame.clientHeight; + } }, // hack @@ -188,7 +200,8 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{ _setViewPortMeta: function (width, height) { if (this._isAdjustViewPort) { - var viewportMetas = {"user-scalable": "no", "maximum-scale": "1.0", "initial-scale": "1.0"}, elems = document.getElementsByName("viewport"), vp, content; + var viewportMetas = {"user-scalable": "no", "maximum-scale": "1.0", "initial-scale": "1.0", width: "device-width"}, + elems = document.getElementsByName("viewport"), vp, content; if (elems.length == 0) { vp = cc.newElement("meta"); vp.name = "viewport";