Skip to content

Commit c1550a3

Browse files
committed
fixed cocos2d#1463 correct some mistake for CCBReader
1 parent 63672de commit c1550a3

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

cocos2d/label_nodes/CCLabelTTF.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,22 +295,26 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{
295295
if (context.font != this._fontStyleStr)
296296
context.font = this._fontStyleStr;
297297

298-
context.textBaseline = cc.LabelTTF._textBaseline[this._vAlignment];
299-
context.textAlign = cc.LabelTTF._textAlign[this._hAlignment];
300-
301298
if (((this._contentSize.width > this._dimensions.width) || this._string.indexOf("\n") > -1) && this._dimensions.width !== 0) {
299+
context.textBaseline = cc.LabelTTF._textBaseline[this._vAlignment];
300+
context.textAlign = cc.LabelTTF._textAlign[this._hAlignment];
302301
this._wrapText(context, this._string,
303302
-this._dimensions.width * this._anchorPoint.x,
304303
this._dimensions.height * this._anchorPoint.y,
305304
this._dimensions.width,
306305
this._dimensions.height,
307306
this._fontSize * 1.2);
308307
} else if (this._dimensions.width == 0) {
308+
context.textBaseline = "bottom";
309+
context.textAlign = "left";
309310
if (this._string.indexOf("\n") > -1)
310311
this._multiLineText(context);
311-
else
312-
context.fillText(this._string, -this._contentSize.width * this._anchorPoint.x, this._contentSize.height * this._anchorPoint.y);
312+
else {
313+
context.fillText(this._string, -this._contentSize.width * this._anchorPoint.x, this._contentSize.height * this._anchorPoint.y);
314+
}
313315
} else {
316+
context.textBaseline = cc.LabelTTF._textBaseline[this._vAlignment];
317+
context.textAlign = cc.LabelTTF._textAlign[this._hAlignment];
314318
var xOffset = 0, yOffset = 0;
315319
if (this._hAlignment == cc.TEXT_ALIGNMENT_RIGHT)
316320
xOffset = this._dimensions.width;

extensions/CCBReader/CCBAnimationManager.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,11 @@ cc.CCBAnimationManager = cc.Class.extend({
219219
if(nodeBaseValues){
220220
var baseKeys = nodeBaseValues.allKeys();
221221
for(j = 0; j < baseKeys.length;j++){
222-
if(seqNodePropNames.indexOf(baseKeys[j]) > -1){
223-
var value = nodeBaseValues.objectForKey(baseKeys[j]);
222+
var selBaseKey = baseKeys[j];
223+
if(seqNodePropNames.indexOf(selBaseKey) == -1){
224+
var value = nodeBaseValues.objectForKey(selBaseKey);
224225
if(value)
225-
this._setAnimatedProperty(baseKeys[j],node, value, tweenDuration);
226+
this._setAnimatedProperty(selBaseKey,node, value, tweenDuration);
226227
}
227228
}
228229
}
@@ -281,7 +282,7 @@ cc.CCBAnimationManager = cc.Class.extend({
281282
} else if (propName == "opacity") {
282283
return cc.FadeTo.create(duration, keyframe1.getValue());
283284
} else if (propName == "color") {
284-
var selColor = keyframe1.getValue();
285+
var selColor = keyframe1.getValue().getColor();
285286
return cc.TintTo.create(duration, selColor.r, selColor.g, selColor.b);
286287
} else if (propName == "visible") {
287288
var isVisible = keyframe1.getValue();

extensions/CCBReader/CCNodeLoader.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,14 +717,17 @@ cc.NodeLoader = cc.Class.extend({
717717

718718
var size ;
719719
var bytes = cc.FileUtils.getInstance().getFileData(path,"rb", size);
720-
size = bytes.length;
720+
721721
myCCBReader.initWithData(bytes,ccbReader.getOwner());
722722
myCCBReader.getAnimationManager().setRootContainerSize(parent.getContentSize());
723723
myCCBReader.setAnimationManagers(ccbReader.getAnimationManagers());
724+
724725
var ccbFileNode = myCCBReader.readFileWithCleanUp(false);
726+
725727
ccbReader.setAnimationManagers(myCCBReader.getAnimationManagers());
726-
if(ccbFileNode && ccbReader.getAnimationManager().getAutoPlaySequenceId() != -1)
727-
ccbReader.getAnimationManager().runAnimations(ccbReader.getAnimationManager().getAutoPlaySequenceId(),0);
728+
729+
if(ccbFileNode && myCCBReader.getAnimationManager().getAutoPlaySequenceId() != -1)
730+
myCCBReader.getAnimationManager().runAnimations(myCCBReader.getAnimationManager().getAutoPlaySequenceId(),0);
728731

729732
return ccbFileNode;
730733
},

0 commit comments

Comments
 (0)