Skip to content

Commit

Permalink
Merge pull request #2344 from asturur/emptypath
Browse files Browse the repository at this point in the history
Allow to create path with empty path
  • Loading branch information
kangax committed Jul 15, 2015
2 parents 0e154be + d36945f commit 61d4f4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/shapes/path.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
this.setOptions(options);

if (!path) {
throw new Error('`path` argument is required');
path = [ ];
}

var fromArray = _toString.call(path) === '[object Array]';
Expand Down Expand Up @@ -888,10 +888,10 @@
aY.push(y);
}

var minX = min(aX),
minY = min(aY),
maxX = max(aX),
maxY = max(aY),
var minX = min(aX) || 0,
minY = min(aY) || 0,
maxX = max(aX) || 0,
maxY = max(aY) || 0,
deltaX = maxX - minX,
deltaY = maxY - minY,

Expand Down
2 changes: 1 addition & 1 deletion test/unit/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
error = err;
}

ok(error, 'should throw error');
ok(typeof error === 'undefined', 'should not throw error on empty path');
start();
});
});
Expand Down

0 comments on commit 61d4f4d

Please sign in to comment.