mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Simplify intersection sort function.
This commit is contained in:
parent
56bf87ce84
commit
4e5644f264
1 changed files with 3 additions and 5 deletions
|
@ -116,11 +116,9 @@ PathItem.inject(new function() {
|
|||
// does not change between two intersections.
|
||||
// First, sort all segments with an intersection to the begining.
|
||||
segments.sort(function(a, b) {
|
||||
var ixa = a._intersection,
|
||||
ixb = b._intersection;
|
||||
if (!ixa && !ixb || ixa && ixb)
|
||||
return 0;
|
||||
return ixa ? -1 : 1;
|
||||
var _a = a._intersection,
|
||||
_b = b._intersection;
|
||||
return !_a && !_b || _a && _b ? 0 : _a ? -1 : 1;
|
||||
});
|
||||
for (i = 0, l = segments.length; i < l; i++) {
|
||||
segment = segments[i];
|
||||
|
|
Loading…
Reference in a new issue