diff --git a/cocos2d/core/CCScene.js b/cocos2d/core/CCScene.js index 1ed946f8db..6160bc2003 100644 --- a/cocos2d/core/CCScene.js +++ b/cocos2d/core/CCScene.js @@ -38,6 +38,8 @@ cc.Scene = cc.Class({ ctor: function () { var sgNode = this._sgNode = new _ccsg.Scene(); sgNode.setAnchorPoint(0.0, 0.0); + this._anchorPoint.x = 0.0; + this._anchorPoint.y = 0.0; this._activeInHierarchy = false; this._inited = !cc.game._isCloning; diff --git a/cocos2d/core/base-ui/CCWidgetManager.js b/cocos2d/core/base-ui/CCWidgetManager.js index e84cf9d890..17c50f507e 100644 --- a/cocos2d/core/base-ui/CCWidgetManager.js +++ b/cocos2d/core/base-ui/CCWidgetManager.js @@ -42,7 +42,19 @@ function getParentSize (parent) { function alignToParent (node, widget) { var parent = node._parent; - var parentAnchor = parent._anchorPoint; + var parentAnchor; + if (parent instanceof cc.Scene) { + if (cc.visibleRect.width > 0 && cc.visibleRect.height > 0) { + parentAnchor = new cc.Vec2(-cc.visibleRect.bottomLeft.x / cc.visibleRect.width, + -cc.visibleRect.bottomLeft.y / cc.visibleRect.height); + } + else { + parentAnchor = cc.Vec2.ZERO; + } + } + else { + parentAnchor = parent._anchorPoint; + } var parentSize = getParentSize(parent); var parentWidth = parentSize.width; var parentHeight = parentSize.height; diff --git a/cocos2d/core/components/CCCanvas.js b/cocos2d/core/components/CCCanvas.js index 59a2105213..43e69bf397 100644 --- a/cocos2d/core/components/CCCanvas.js +++ b/cocos2d/core/components/CCCanvas.js @@ -24,7 +24,7 @@ var designResolutionWrapper = { getContentSize: function () { - return CC_EDITOR ? cc.engine.getDesignResolutionSize() : cc.size(cc.visibleRect); + return CC_EDITOR ? cc.engine.getDesignResolutionSize() : cc.view.getDesignResolutionSize(); }, setContentSize: function (size) { // NYI diff --git a/cocos2d/core/platform/CCAssetLibrary.js b/cocos2d/core/platform/CCAssetLibrary.js index 2898914a50..3be5c8113d 100644 --- a/cocos2d/core/platform/CCAssetLibrary.js +++ b/cocos2d/core/platform/CCAssetLibrary.js @@ -335,12 +335,15 @@ var AssetLibrary = { --pendingCount; if (pendingCount === 0) { callback(); + callback = null; } }); } if (pendingCount === 0) { - callback(); + if (callback) { + callback(); + } return; }