sort markers by date (newest on top)

This commit is contained in:
Martin Raifer
2024-08-07 10:00:59 +02:00
parent 136308821a
commit a8e438c58d
2 changed files with 5 additions and 2 deletions

View File

@@ -76,7 +76,7 @@ function searchLimited(limit, projection, rtree) {
return 0;
})
.slice(0, limit)
.map(function(d) { return d.data; });
.map(d => d.data);
return (found.length ? result.concat(found) : result);
}, []);
@@ -158,6 +158,7 @@ function loadTileDataToCache(data, tile, zoom) {
d = {
loc: loc,
capture_time: feature.properties.ts,
capture_time_parsed: new Date(feature.properties.ts),
id: feature.properties.id,
account_id: feature.properties.account_id,
sequence_id: feature.properties.sequences.split('\"')[1],

View File

@@ -254,9 +254,11 @@ export function svgPanoramaxImages(projection, context, dispatch) {
const markers = groups
.merge(groupsEnter)
.sort(function(a, b) {
// active image on top
if (a.id === activeImageId) return 1;
if (b.id === activeImageId) return -1;
return b.loc[1] - a.loc[1]; // sort Y
// else: sort by capture time (newest on top)
return a.capture_time_parsed - b.capture_time_parsed;
})
.attr('transform', transform)
.select('.viewfield-scale');