mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Fix bug in CompoundPath#draw(ctx, draw) which was causing an error when a compound path didn't have any children.
This commit is contained in:
parent
43cc8e45b2
commit
63628be923
1 changed files with 6 additions and 1 deletions
|
@ -85,10 +85,15 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
|
||||||
},
|
},
|
||||||
|
|
||||||
draw: function(ctx, param) {
|
draw: function(ctx, param) {
|
||||||
|
var l = this._children.length;
|
||||||
|
// Return early if the compound path doesn't have any children:
|
||||||
|
if (l == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var firstChild = this._children[0];
|
var firstChild = this._children[0];
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
param.compound = true;
|
param.compound = true;
|
||||||
for (var i = 0, l = this._children.length; i < l; i++)
|
for (var i = 0; i < l; i++)
|
||||||
Item.draw(this._children[i], ctx, param);
|
Item.draw(this._children[i], ctx, param);
|
||||||
firstChild._setStyles(ctx);
|
firstChild._setStyles(ctx);
|
||||||
var fillColor = firstChild.getFillColor(),
|
var fillColor = firstChild.getFillColor(),
|
||||||
|
|
Loading…
Reference in a new issue