Simplify intersection sort function.

This commit is contained in:
Jürg Lehni 2014-02-20 00:32:15 +01:00
parent 56bf87ce84
commit 4e5644f264

View file

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