Skip to content

Commit a18882a

Browse files
author
Jose Antonio Andújar Clavell
committed
Bug in SceneReader setPropertyFromJsonDict
1 parent b474ebc commit a18882a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

extensions/CocoStudio/Reader/SceneReader.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -348,25 +348,25 @@ ccs.SceneReader = ccs.Class.extend(/** @lends ccs.SceneReader# */{
348348
* @param {Object} dict
349349
*/
350350
setPropertyFromJsonDict: function (node, dict) {
351-
var x = dict["x"] || 0;
352-
var y = dict["y"] || 0;
351+
var x = (typeof dict["x"] === 'undefined')?0:dict["x"];
352+
var y = (typeof dict["y"] === 'undefined')?0:dict["y"];
353353
node.setPosition(cc.p(x, y));
354354

355-
var bVisible = Boolean(dict["visible"] || 1);
355+
var bVisible = Boolean((typeof dict["visible"] === 'undefined')?1:dict["visible"]);
356356
node.setVisible(bVisible);
357357

358-
var nTag = dict["objecttag"] || -1;
358+
var nTag = (typeof dict["objecttag"] === 'undefined')?-1:dict["objecttag"];
359359
node.setTag(nTag);
360360

361-
var nZorder = dict["zorder"] || 0;
361+
var nZorder = (typeof dict["zorder"] === 'undefined')?0:dict["zorder"];
362362
node.setZOrder(nZorder);
363363

364-
var fScaleX = dict["scalex"] || 1;
365-
var fScaleY = dict["scaley"] || 1;
364+
var fScaleX = (typeof dict["scalex"] === 'undefined')?1:dict["scalex"];
365+
var fScaleY = (typeof dict["scaley"] === 'undefined')?1:dict["scaley"];
366366
node.setScaleX(fScaleX);
367367
node.setScaleY(fScaleY);
368368

369-
var fRotationZ = dict["rotation"] || 0;
369+
var fRotationZ = (typeof dict["rotation"] === 'undefined')?0:dict["rotation"];
370370
node.setRotation(fRotationZ);
371371
},
372372
setTarget : function(selector,listener){

0 commit comments

Comments
 (0)