Skip to content

Commit 7d926a4

Browse files
misuse " || "
1 parent f7a08bb commit 7d926a4

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

cocos2d/actions/CCActionInstant.js

Lines changed: 3 additions & 3 deletions
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/label_nodes/CCLabelBMFont.js

Lines changed: 3 additions & 3 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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)