canvas should use design resolution size (+1 squashed commit)

Squashed commits:
[edaaa1b] fix computing position of standalone widget
This commit is contained in:
Jare Guo
2015-12-11 16:54:10 +08:00
parent 8bc463aa60
commit 1ddec54b1c
4 changed files with 20 additions and 3 deletions
+2
View File
@@ -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;
+13 -1
View File
@@ -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;
+1 -1
View File
@@ -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
+4 -1
View File
@@ -335,12 +335,15 @@ var AssetLibrary = {
--pendingCount;
if (pendingCount === 0) {
callback();
callback = null;
}
});
}
if (pendingCount === 0) {
callback();
if (callback) {
callback();
}
return;
}