Skip to content
Merged
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
19 changes: 16 additions & 3 deletions cocos2d/core/platform/CCEGLView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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";
Expand Down