mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
canvas should use design resolution size (+1 squashed commit)
Squashed commits: [edaaa1b] fix computing position of standalone widget
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -335,12 +335,15 @@ var AssetLibrary = {
|
||||
--pendingCount;
|
||||
if (pendingCount === 0) {
|
||||
callback();
|
||||
callback = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (pendingCount === 0) {
|
||||
callback();
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user