From 065bba7ec445b234d9583a8daf80baf1381901ff Mon Sep 17 00:00:00 2001 From: Sebastian Kreft Date: Mon, 9 Mar 2020 20:38:07 -0300 Subject: [PATCH] Path intersection was not checking paths with circles. 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. --- plugins/_path.js | 2 -- test/plugins/mergePaths.05.svg | 19 +++++++++++++++++++ test/plugins/mergePaths.06.svg | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 test/plugins/mergePaths.05.svg create mode 100644 test/plugins/mergePaths.06.svg diff --git a/plugins/_path.js b/plugins/_path.js index bb613c6ae..889317b6a 100644 --- a/plugins/_path.js +++ b/plugins/_path.js @@ -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, []); diff --git a/test/plugins/mergePaths.05.svg b/test/plugins/mergePaths.05.svg new file mode 100644 index 000000000..57c6b74bb --- /dev/null +++ b/test/plugins/mergePaths.05.svg @@ -0,0 +1,19 @@ + + + + + + + + + +@@@ + + + + + + + + + diff --git a/test/plugins/mergePaths.06.svg b/test/plugins/mergePaths.06.svg new file mode 100644 index 000000000..46198da45 --- /dev/null +++ b/test/plugins/mergePaths.06.svg @@ -0,0 +1,20 @@ + + + + + + + + + + +@@@ + + + + + + + + +