Skip to content

Commit

Permalink
Use numeric sort comparator for sorting symbol query results.
Browse files Browse the repository at this point in the history
Matches topDownComparator of FeatureIndex.
Previous behavior was string sorting, which could provide unexpected results with multi-digit feature indices.
Update query tests to match new order.
  • Loading branch information
ChrisLoer committed May 18, 2018
1 parent 63efc49 commit 021c582
Show file tree
Hide file tree
Showing 5 changed files with 591 additions and 591 deletions.
2 changes: 1 addition & 1 deletion src/symbol/collision_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class CollisionIndex {
result[featureKey.bucketInstanceId].push(featureKey.featureIndex);
}
for (const bucket in result) {
result[bucket].sort();
result[bucket].sort((a, b) => b - a); // Match topDownFeatureComparator from FeatureIndex
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"geometry": {
"type": "Point",
"coordinates": [
2.9999542236328125,
4.000053405761719,
4.000061604283047
]
},
Expand All @@ -47,7 +47,7 @@
"geometry": {
"type": "Point",
"coordinates": [
4.000053405761719,
2.9999542236328125,
4.000061604283047
]
},
Expand Down
Loading

0 comments on commit 021c582

Please sign in to comment.