Fix #1769 and add additional test case (#1772)

This commit is contained in:
waruyama 2020-02-10 23:49:50 +01:00 committed by GitHub
parent efcdd7bda8
commit 1efa0edb50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

@ -1 +1 @@
Subproject commit 16a58d078c5b72070aa34f1795807361098246d6
Subproject commit 0fb6283f0955b8ee92fc9ac8838f167ea4a965d2

@ -1 +1 @@
Subproject commit 3d396c63ecbe01d197b6bf3c6129823331f403d4
Subproject commit 1e276564106e5a29a6e00115c7e703cfc1fc2b09

View file

@ -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;

View file

@ -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.');
});