mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-28 17:02:24 -05:00
parent
e779d24a6d
commit
978cd94a9e
2 changed files with 16 additions and 5 deletions
|
@ -715,10 +715,14 @@ PathItem.inject(new function() {
|
|||
totalLength = 0,
|
||||
winding;
|
||||
do {
|
||||
var curve = segment.getCurve(),
|
||||
length = curve.getLength();
|
||||
chain.push({ segment: segment, curve: curve, length: length });
|
||||
totalLength += length;
|
||||
var curve = segment.getCurve();
|
||||
// We can encounter paths with only one segment, which would not
|
||||
// have a curve.
|
||||
if (curve) {
|
||||
var length = curve.getLength();
|
||||
chain.push({ segment: segment, curve: curve, length: length });
|
||||
totalLength += length;
|
||||
}
|
||||
segment = segment.getNext();
|
||||
} while (segment && !segment._intersection && segment !== start);
|
||||
// Determine winding at three points in the chain. If a winding with
|
||||
|
|
|
@ -1214,4 +1214,11 @@ test('#1419', function() {
|
|||
});
|
||||
var result = 'M-50,0c0,-27.61424 22.38576,-50 50,-50c7.33673,0 14.30439,1.5802 20.58119,4.41881c-7.84546,-17.34804 -25.30368,-29.41881 -45.58119,-29.41881c-27.61424,0 -50,22.38576 -50,50c0,20.27751 12.07077,37.73573 29.41881,45.58119c-2.83861,-6.2768 -4.41881,-13.24446 -4.41881,-20.58119zM50,0c0,27.61424 -22.38576,50 -50,50c-20.27751,0 -37.73573,-12.07077 -45.58119,-29.41881c6.2768,2.83861 13.24446,4.41881 20.58119,4.41881c27.61424,0 50,-22.38576 50,-50c0,-7.33673 -1.5802,-14.30439 -4.41881,-20.58119c17.34804,7.84546 29.41881,25.30368 29.41881,45.58119z';
|
||||
compareBoolean(circle1.exclude(circle2), result);
|
||||
})
|
||||
});
|
||||
|
||||
test('#1351', function() {
|
||||
var path1 = new CompoundPath(new Path([10, 10], [100, 100]), new Path([150, 25]));
|
||||
var path2 = new Path([20, 80], [80, 20]);
|
||||
var result = 'M10,10l40,40l50,50';
|
||||
compareBoolean(path1.unite(path2), result);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue