Merge branch 'v1.2' of github.com:cocos-creator/engine into v1.2

This commit is contained in:
Nan Wang
2016-08-19 15:56:22 +08:00
6 changed files with 31 additions and 9 deletions
+6
View File
@@ -969,6 +969,12 @@ var Node = cc.Class({
// activate
cc.director.getActionManager().resumeTarget(this);
cc.eventManager.resumeTarget(this);
if (this._touchListener) {
this._touchListener.mask = _searchMaskParent(this);
}
if (this._mouseListener) {
this._mouseListener.mask = _searchMaskParent(this);
}
}
else {
// deactivate
+5 -1
View File
@@ -813,6 +813,7 @@ var ScrollView = cc.Class({
}
this._moveContent(moveDelta);
this._adjustContentOutOfBoundary();
},
_calculateBoundary: function() {
@@ -1331,6 +1332,7 @@ var ScrollView = cc.Class({
var newPosition = cc.pAdd(this.getContentPosition(), outOfBoundary);
if(this.content) {
this.content.setPosition(newPosition);
this._updateScrollBar(0);
}
}
},
@@ -1339,7 +1341,9 @@ var ScrollView = cc.Class({
this._calculateBoundary();
//Because widget component will adjust content position and scrollview position is correct after visit
//So this event could make sure the content is on the correct position after loading.
cc.director.once(cc.Director.EVENT_AFTER_VISIT, this._adjustContentOutOfBoundary, this);
if(this.content) {
cc.director.once(cc.Director.EVENT_AFTER_VISIT, this._adjustContentOutOfBoundary, this);
}
},
onDestroy: function() {
+3
View File
@@ -359,6 +359,7 @@ _ccsg.Label = _ccsg.Node.extend({
this._fontHandle = fontHandle;
this._labelType = _ccsg.Label.Type.SystemFont;
this._blendFunc = cc.BlendFunc._alphaPremultiplied();
this._renderCmd._needDraw = true;
this._notifyLabelSkinDirty();
this.emit('load');
return;
@@ -367,11 +368,13 @@ _ccsg.Label = _ccsg.Node.extend({
if (extName === ".ttf") {
this._labelType = _ccsg.Label.Type.TTF;
this._blendFunc = cc.BlendFunc._alphaPremultiplied();
this._renderCmd._needDraw = true;
this._fontHandle = this._loadTTFFont(fontHandle);
} else if (extName === ".fnt") {
//todo add bmfont here
this._labelType = _ccsg.Label.Type.BMFont;
this._blendFunc = cc.BlendFunc._alphaNonPremultiplied();
this._renderCmd._needDraw = false;
this._initBMFontWithString(this._string, fontHandle, textureUrl);
}
this._notifyLabelSkinDirty();
@@ -69,7 +69,8 @@ proto._updateDisplayOpacity = function (parentOpacity) {
proto.transform = function (parentCmd, recursive) {
this.originTransform(parentCmd, recursive);
var lx = 0, rx = this._labelCanvas.width,
var node = this._node,
lx = 0, rx = this._labelCanvas.width,
by = 0, ty = this._labelCanvas.height,
wt = this._worldTransform;
@@ -83,6 +84,12 @@ proto.transform = function (parentCmd, recursive) {
vert[3].x = rx * wt.a + by * wt.c + wt.tx; // br
vert[3].y = rx * wt.b + by * wt.d + wt.ty;
if (!node._string || (node._labelType !== _ccsg.Label.Type.TTF &&
node._labelType !== _ccsg.Label.Type.SystemFont)) {
// No culling for bmfont
return;
}
var rect = cc.visibleRect,
vl = rect.left.x, vr = rect.right.x, vt = rect.top.y, vb = rect.bottom.y;
if (((vert[0].x-vl) & (vert[1].x-vl) & (vert[2].x-vl) & (vert[3].x-vl)) >> 31 || // All outside left
+9 -6
View File
@@ -1003,10 +1003,10 @@ function parseAttributes (attrs, className, propName) {
}
function parseSimpleAttr (attrName, expectType, attrCreater) {
var val = attrs[attrName];
if (val) {
if (attrName in attrs) {
var val = attrs[attrName];
if (typeof val === expectType) {
if (typeof attrCreater === 'undefined') {
if ( !attrCreater ) {
var attr = {};
attr[attrName] = val;
result.push(attr);
@@ -1016,7 +1016,7 @@ function parseAttributes (attrs, className, propName) {
}
}
else if (CC_DEV) {
cc.error('The %s of %s.%s must be type %s', attrName, className, propName, expectType);
cc.error(ERR_Type, attrName, className, propName, expectType);
}
}
}
@@ -1070,13 +1070,16 @@ function parseAttributes (attrs, className, propName) {
result.push({ min: range[0], max: range[1], step: range[2] });
}
else if (CC_DEV) {
cc.error('The length of range array must be 2');
cc.error('The length of range array must be equal or greater than 2');
}
}
else if (CC_DEV) {
cc.error(ERR_Type, '"range"', className + '.' + propName, 'array');
cc.error(ERR_Type, 'range', className, propName, 'array');
}
}
parseSimpleAttr('min', 'number');
parseSimpleAttr('max', 'number');
parseSimpleAttr('step', 'number');
return result;
}
-1
View File
@@ -96,7 +96,6 @@ var Texture2D = cc.Class(/** @lends cc.Texture2D# */{
this._isGray = false;
}
else if (cc._renderType === game.RENDER_TYPE_WEBGL) {
this._hasPremultipliedAlpha = false;
this._pixelFormat = Texture2D.defaultPixelFormat;
this._hasPremultipliedAlpha = false;
this._hasMipmaps = false;