From 1efa0edb505f679581a4ff8b63914250e6c3398d Mon Sep 17 00:00:00 2001 From: waruyama <43434568+waruyama@users.noreply.github.com> Date: Mon, 10 Feb 2020 23:49:50 +0100 Subject: [PATCH] Fix #1769 and add additional test case (#1772) --- packages/paper-jsdom | 2 +- packages/paper-jsdom-canvas | 2 +- src/path/PathItem.js | 2 +- test/tests/PathItem.js | 12 ++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/paper-jsdom b/packages/paper-jsdom index 16a58d07..0fb6283f 160000 --- a/packages/paper-jsdom +++ b/packages/paper-jsdom @@ -1 +1 @@ -Subproject commit 16a58d078c5b72070aa34f1795807361098246d6 +Subproject commit 0fb6283f0955b8ee92fc9ac8838f167ea4a965d2 diff --git a/packages/paper-jsdom-canvas b/packages/paper-jsdom-canvas index 3d396c63..1e276564 160000 --- a/packages/paper-jsdom-canvas +++ b/packages/paper-jsdom-canvas @@ -1 +1 @@ -Subproject commit 3d396c63ecbe01d197b6bf3c6129823331f403d4 +Subproject commit 1e276564106e5a29a6e00115c7e703cfc1fc2b09 diff --git a/src/path/PathItem.js b/src/path/PathItem.js index 03115233..d11cf738 100644 --- a/src/path/PathItem.js +++ b/src/path/PathItem.js @@ -722,7 +722,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{ matched = [], count = 0; ok = true; - var boundsOverlaps = CollisionDetection.findBoundsOverlaps(paths1, paths2, Numerical.GEOMETRIC_EPSILON); + var boundsOverlaps = CollisionDetection.findItemBoundsCollisions(paths1, paths2, Numerical.GEOMETRIC_EPSILON); for (var i1 = length1 - 1; i1 >= 0 && ok; i1--) { var path1 = paths1[i1]; ok = false; diff --git a/test/tests/PathItem.js b/test/tests/PathItem.js index e92c4a1e..94d5638f 100644 --- a/test/tests/PathItem.js +++ b/test/tests/PathItem.js @@ -165,4 +165,16 @@ test('PathItem#compare()', function() { equals(function() { return circle2.compare(circle); }, true, 'Comparing a circle with additional segments with an identical circle should return true.'); + + var compoundPath1 = PathItem.create('M50,300l0,-150l50,25l0,-75l200,0l0,200z M100,200l50,0l-50,-25z'); + var compoundPath2 = PathItem.create('M50,300l0,-150l50,25l0,-75l200,0l0,200z M100,175l0,25l50,0z'); + var compoundPath3 = PathItem.create('M50,300l0,-150l50,25l0,-75l200,0l0,210z M100,200l50,0l-50,-25z'); + + equals(function() { + return compoundPath1.compare(compoundPath2); + }, true, 'Comparing two compound paths with one child starting at a different point should return true.'); + equals(function() { + return compoundPath1.compare(compoundPath3); + }, false, 'Comparing two compound paths with one child having a different shape should return false.'); + });