From 355381e0d8650004f7d31a97a6fab5c9309d37b8 Mon Sep 17 00:00:00 2001 From: Mykyta Usikov Date: Wed, 27 May 2015 11:25:04 +0300 Subject: [PATCH] cc.Color() and cc.color() don't replace 0 alpha with 255 no more --- cocos/scripting/js-bindings/script/jsb_cocos2d.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/cocos/scripting/js-bindings/script/jsb_cocos2d.js index f3ede487b4..b7a92806f4 100644 --- a/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -1094,7 +1094,7 @@ cc.Color = function (r, g, b, a) { this.r = r || 0; this.g = g || 0; this.b = b || 0; - this.a = a || 255; + this.a = (a === undefined) ? 255 : a; }; /** @@ -1124,8 +1124,8 @@ cc.color = function (r, g, b, a) { if (typeof r === "string") return cc.hexToColor(r); if (typeof r === "object") - return {r: r.r, g: r.g, b: r.b, a: r.a || 255}; - return {r: r, g: g, b: b, a: a || 255}; + return {r: r.r, g: r.g, b: r.b, a: (r.a === undefined) ? 255 : r.a}; + return {r: r, g: g, b: b, a: (a === undefined ? 255 : a)}; }; /**