From 8e9016f3625e451b46fb4300e4997d85116bcb24 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 19 Aug 2016 16:06:55 +0800 Subject: [PATCH 1/2] Fix Orientation not supported in Fit height & Fit width mode --- cocos2d/core/platform/CCView.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cocos2d/core/platform/CCView.js b/cocos2d/core/platform/CCView.js index c5703f7016..053632db0f 100644 --- a/cocos2d/core/platform/CCView.js +++ b/cocos2d/core/platform/CCView.js @@ -154,7 +154,7 @@ var View = cc._Class.extend({ * Constructor of View */ ctor: function () { - var _t = this, d = document, _strategyer = cc.ContainerStrategy, _strategy = cc.ContentStrategy; + var _t = this, _strategyer = cc.ContainerStrategy, _strategy = cc.ContentStrategy; __BrowserGetter.init(this); @@ -1055,7 +1055,15 @@ cc.ContentStrategy = cc._Class.extend(/** @lends cc.ContentStrategy# */{ */ var EqualToFrame = cc.ContainerStrategy.extend({ apply: function (view) { + var frameH = view._frameSize.height, containerStyle = cc.container.style; this._setupContainer(view, view._frameSize.width, view._frameSize.height); + // Setup container's margin and padding + if (view._isRotated) { + containerStyle.marginLeft = frameH + 'px'; + } + else { + containerStyle.margin = '0px'; + } } }); From 42b00ebcb9fc34414c40c81d893ac15088647a84 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 19 Aug 2016 16:25:06 +0800 Subject: [PATCH 2/2] Force update all scene after set design resolution policy --- cocos2d/core/platform/CCView.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cocos2d/core/platform/CCView.js b/cocos2d/core/platform/CCView.js index 053632db0f..d65dc9b54c 100644 --- a/cocos2d/core/platform/CCView.js +++ b/cocos2d/core/platform/CCView.js @@ -703,6 +703,9 @@ var View = cc._Class.extend({ // reset director's member variables to fit visible rect director.setGLDefaultValues(); } + else if (cc._renderType === cc.game.RENDER_TYPE_CANVAS) { + cc.renderer._allNeedDraw = true; + } this._originalScaleX = this._scaleX; this._originalScaleY = this._scaleY;