Skip to content

Commit 3622929

Browse files
author
SeanLin
committed
Merge pull request #743 from ShengxiangChen/spriteBug
Fixed HyBrid Sprite Test
2 parents 1b8a0e3 + 7d926a4 commit 3622929

File tree

7 files changed

+25
-15
lines changed

7 files changed

+25
-15
lines changed

cocos2d/actions/CCActionInstant.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{
284284
* @return {Boolean}
285285
*/
286286
initWithTarget:function (selector, selectorTarget, data) {
287-
this._data = data || null;
288-
this._callFunc = selector || null;
289-
this._selectorTarget = selectorTarget || null;
287+
this._data = data;
288+
this._callFunc = selector;
289+
this._selectorTarget = selectorTarget;
290290
return true;
291291
},
292292

cocos2d/base_nodes/CCNode.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,9 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
10261026
*/
10271027
removeFromParent:function (cleanup) {
10281028
if (this._parent) {
1029-
cleanup = cleanup || true;
1029+
if (cleanup == null){
1030+
cleanup = true;
1031+
}
10301032
this._parent.removeChild(this, cleanup);
10311033
}
10321034
},
@@ -1051,7 +1053,9 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
10511053
return;
10521054
}
10531055

1054-
cleanup = cleanup || true;
1056+
if (cleanup == null){
1057+
cleanup = true;
1058+
}
10551059
if (this._children.indexOf(child) > -1) {
10561060
this._detachChild(child, cleanup);
10571061
}
@@ -1090,7 +1094,9 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
10901094
removeAllChildren:function (cleanup) {
10911095
// not using detachChild improves speed here
10921096
if (this._children != null) {
1093-
cleanup = cleanup || true;
1097+
if (cleanup == null){
1098+
cleanup = true;
1099+
}
10941100
for (var i = 0; i < this._children.length; i++) {
10951101
var node = this._children[i];
10961102
if (node) {

cocos2d/label_nodes/CCLabelBMFont.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
537537
* @param {String} fntFile
538538
* @param {String} width
539539
* @param {Number} alignment
540-
* @param {Number} imageOffset
540+
* @param {cc.Point} imageOffset
541541
* @return {Boolean}
542542
*/
543543
initWithString:function (str, fntFile, width, alignment, imageOffset) {
@@ -564,7 +564,7 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
564564
if (this.initWithTexture(texture, theString.length)) {
565565
this._alignment = alignment || cc.TEXT_ALIGNMENT_LEFT;
566566
this._imageOffset = imageOffset || cc.PointZero();
567-
this._width = width || cc.LabelAutomaticWidth;
567+
this._width = (width == null)?cc.LabelAutomaticWidth:width;
568568
this._opacity = 255;
569569
this._color = cc.white();
570570
this._contentSize = cc.SizeZero();
@@ -1035,7 +1035,7 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
10351035
* @param {String} fntFile
10361036
* @param {String} width
10371037
* @param {Number} alignment
1038-
* @param {Number} imageOffset
1038+
* @param {cc.Point} imageOffset
10391039
* @return {cc.LabelBMFont|Null}
10401040
* @example
10411041
* // Example 01

cocos2d/layers_scenes_transitions_nodes/CCLayer.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,9 @@ cc.LayerColor = cc.Layer.extend(/** @lends cc.LayerColor# */{
635635
},
636636

637637
/**
638-
* @param color
638+
* @param {cc.Color4B} color
639+
* @param {Number} width
640+
* @param {Number} height
639641
* @return {Boolean}
640642
*/
641643
init:function (color, width, height) {

cocos2d/misc_nodes/CCRenderTexture.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ cc.RenderTexture = cc.Node.extend(/** @lends cc.RenderTexture# */{
152152
*/
153153
initWithWidthAndHeight:function (width, height, format, depthStencilFormat) {
154154
if (cc.renderContextType == cc.CANVAS) {
155-
this.canvas.width = width || 10;
156-
this.canvas.height = height || 10;
155+
this.canvas.width = (width == null) ? 10 : width;
156+
this.canvas.height = (height == null) ? 10 : height;
157157

158158
this.context.translate(0, this.canvas.height);
159159

cocos2d/sprite_nodes/CCAnimationCache.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ cc.AnimationCache = cc.Class.extend(/** @lends cc.AnimationCache# */{
6969
* @return {cc.Animation}
7070
*/
7171
getAnimation:function (name) {
72-
if(this._animations.hasOwnProperty(name))
72+
if (this._animations.hasOwnProperty(name))
7373
return this._animations[name];
7474
return null;
7575
},
@@ -173,7 +173,9 @@ cc.AnimationCache = cc.Class.extend(/** @lends cc.AnimationCache# */{
173173

174174
for (var key in animations) {
175175
var animationDict = animations[key];
176-
var loops = parseInt(animationDict["loops"]) || 1;
176+
177+
var loopsTemp = parseInt(animationDict["loops"]);
178+
var loops = (loopsTemp == null) ? 1 : loopsTemp;
177179
var restoreOriginalFrame = (animationDict["restoreOriginalFrame"] && animationDict["restoreOriginalFrame"] == true) ? true : false;
178180
var frameArray = animationDict["frames"];
179181

cocos2d/support/CCUserDefault.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ cc.UserDefault = cc.Class.extend(/** @lends cc.UserDefault# */{
113113
*/
114114
getFloatForKey:function (key, defaultValue) {
115115
var value = this._getValueForKey(key);
116-
var ret = defaultValue || 0.0;
116+
var ret = defaultValue || 0;
117117

118118
if (value) {
119119
return parseFloat(value);

0 commit comments

Comments
 (0)