Skip to content

Commit 223b5d3

Browse files
committed
Merge pull request #2713 from dingpinglv/Iss2699_Sprite
Fixed a bug of cc.DrawNode that its lineWidth is always to default value when set linewidth to zero.
2 parents aba13a2 + b62eca8 commit 223b5d3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cocos2d/shape-nodes/CCDrawNode.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ cc.DrawNodeCanvas = cc.Node.extend(/** @lends cc.DrawNode# */{
181181
* @param {cc.Color} lineColor
182182
*/
183183
drawRect: function (origin, destination, fillColor, lineWidth, lineColor) {
184-
lineWidth = lineWidth || this._lineWidth;
184+
lineWidth = (lineWidth == null) ? this._lineWidth : lineWidth;
185185
lineColor = lineColor || this.getDrawColor();
186186
if(lineColor.a == null)
187187
lineColor.a = 255;
@@ -436,7 +436,7 @@ cc.DrawNodeCanvas = cc.Node.extend(/** @lends cc.DrawNode# */{
436436
* @param {cc.Color} color
437437
*/
438438
drawPoly_: function (verts, fillColor, lineWidth, color) {
439-
lineWidth = lineWidth || this._lineWidth;
439+
lineWidth = (lineWidth == null ) ? this._lineWidth : lineWidth;
440440
color = color || this.getDrawColor();
441441
if (color.a == null)
442442
color.a = 255;
@@ -554,7 +554,7 @@ cc.DrawNodeWebGL = cc.Node.extend({
554554
},
555555

556556
drawRect: function (origin, destination, fillColor, lineWidth, lineColor) {
557-
lineWidth = lineWidth || this._lineWidth;
557+
lineWidth = (lineWidth == null) ? this._lineWidth : lineWidth;
558558
lineColor = lineColor || this.getDrawColor();
559559
if (lineColor.a == null)
560560
lineColor.a = 255;
@@ -789,7 +789,7 @@ cc.DrawNodeWebGL = cc.Node.extend({
789789
fillColor.a = 255;
790790
if (borderColor.a == null)
791791
borderColor.a = 255;
792-
borderWidth = borderWidth || this._lineWidth;
792+
borderWidth = (borderWidth == null)? this._lineWidth : borderWidth;
793793
borderWidth *= 0.5;
794794
var c4bFillColor = {r: 0 | fillColor.r, g: 0 | fillColor.g, b: 0 | fillColor.b, a: 0 | fillColor.a};
795795
var c4bBorderColor = {r: 0 | borderColor.r, g: 0 | borderColor.g, b: 0 | borderColor.b, a: 0 | borderColor.a};
@@ -852,7 +852,7 @@ cc.DrawNodeWebGL = cc.Node.extend({
852852
},
853853

854854
_drawSegments: function(verts, borderWidth, borderColor, closePoly){
855-
borderWidth = borderWidth || this._lineWidth;
855+
borderWidth = (borderWidth == null) ? this._lineWidth : borderWidth;
856856
borderColor = borderColor || this._drawColor;
857857
if(borderColor.a == null)
858858
borderColor.a = 255;

0 commit comments

Comments
 (0)