Use index (position on Atlas data) for temporal order

This commit is contained in:
Hans5958 2023-06-15 22:57:35 +07:00
parent a17b9df743
commit da4efb6c60
2 changed files with 5 additions and 3 deletions

View File

@ -500,7 +500,9 @@ async function init() {
}
function updateAtlasAll(atlas = atlasAll) {
for (const entry of atlas) {
for (const index in atlas) {
const entry = atlas[index]
entry._index = index
const currentLinks = entry.links
entry.links = {
website: [],

View File

@ -370,10 +370,10 @@ function buildObjectsList(filter, sort = defaultSort) {
sortFunction = (a, b) => b.name.toLowerCase().localeCompare(a.name.toLowerCase())
break
case "newest":
sortFunction = (a, b) => b.id.length - a.id.length || b.id.localeCompare(a.id)
sortFunction = (a, b) => b._index - a._index
break
case "oldest":
sortFunction = (a, b) => a.id.length - b.id.length || a.id.localeCompare(b.id)
sortFunction = (a, b) => a._index - b._index
break
case "area":
sortFunction = (a, b) => calcPolygonArea(b.path) - calcPolygonArea(a.path)