Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to create path with empty path #2344

Merged
merged 2 commits into from
Jul 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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