Skip to content

Commit

Permalink
Path intersection was not checking paths with circles. (#1229)
Browse files Browse the repository at this point in the history
As an optimization the path intersection was checking the paths had three or more elements, caliming that otherwise there was nothing to fill. However a semi circle would actually contain 2 points.

Fixes #1048.

This adds a simplified test case for the 2 offending files reported in the issue.
  • Loading branch information
sk- authored Feb 17, 2021
1 parent 814863b commit c9a3aea
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 0 additions & 2 deletions plugins/_path.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,6 @@ function set(dest, source) {
* @return {Boolean}
*/
exports.intersects = function(path1, path2) {
if (path1.length < 3 || path2.length < 3) return false; // nothing to fill

// Collect points of every subpath.
var points1 = relative2absolute(path1).reduce(gatherPoints, []),
points2 = relative2absolute(path2).reduce(gatherPoints, []);
Expand Down
19 changes: 19 additions & 0 deletions test/plugins/mergePaths.05.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions test/plugins/mergePaths.06.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c9a3aea

Please sign in to comment.