diff --git a/modules/services/panoramax.js b/modules/services/panoramax.js index 021cc4ee5..1e0efb2c6 100644 --- a/modules/services/panoramax.js +++ b/modules/services/panoramax.js @@ -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], diff --git a/modules/svg/panoramax_images.js b/modules/svg/panoramax_images.js index e4374e376..439564f42 100644 --- a/modules/svg/panoramax_images.js +++ b/modules/svg/panoramax_images.js @@ -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');