mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-09-26 20:18:58 +02:00
parent
4362aa81b1
commit
b2f287180c
1 changed files with 63 additions and 56 deletions
|
@ -768,15 +768,31 @@ function highlightEntryFromUrl() {
|
||||||
updateTime(defaultPeriod, defaultVariation, true)
|
updateTime(defaultPeriod, defaultVariation, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id) {
|
if (!id) return
|
||||||
|
|
||||||
const entries = atlas.filter(function (e) {
|
const entries = atlas.filter(function (e) {
|
||||||
return e.id === id
|
return e.id === id
|
||||||
})
|
})
|
||||||
|
|
||||||
if (entries.length === 1) {
|
if (entries.length !== 1) return
|
||||||
|
|
||||||
const entry = entries[0]
|
const entry = entries[0]
|
||||||
|
|
||||||
|
let boundingBox = [2000, 0, 2000, 0]
|
||||||
|
entry.path?.forEach(([x, y]) => {
|
||||||
|
boundingBox[0] = Math.min(boundingBox[0], x)
|
||||||
|
boundingBox[1] = Math.max(boundingBox[1], x)
|
||||||
|
boundingBox[2] = Math.min(boundingBox[2], y)
|
||||||
|
boundingBox[3] = Math.max(boundingBox[3], y)
|
||||||
|
})
|
||||||
|
const boundingBoxSize = [boundingBox[1] - boundingBox[0], boundingBox[3] - boundingBox[2]]
|
||||||
|
const clientSize = [
|
||||||
|
Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
|
||||||
|
Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
|
||||||
|
]
|
||||||
|
zoom = Math.min(clientSize[0] / boundingBoxSize[0], clientSize[1] / boundingBoxSize[1])
|
||||||
|
zoom = Math.min(4, zoom/2)
|
||||||
|
|
||||||
document.title = entry.name + " on the 2022 r/place Atlas"
|
document.title = entry.name + " on the 2022 r/place Atlas"
|
||||||
|
|
||||||
if ((!entry.diff || entry.diff !== "delete")) {
|
if ((!entry.diff || entry.diff !== "delete")) {
|
||||||
|
@ -800,10 +816,6 @@ function highlightEntryFromUrl() {
|
||||||
objectsContainer.replaceChildren()
|
objectsContainer.replaceChildren()
|
||||||
objectsContainer.appendChild(infoElement)
|
objectsContainer.appendChild(infoElement)
|
||||||
|
|
||||||
//console.log(entry.center[0])
|
|
||||||
//console.log(entry.center[1])
|
|
||||||
|
|
||||||
zoom = 4
|
|
||||||
renderBackground(atlas)
|
renderBackground(atlas)
|
||||||
applyView()
|
applyView()
|
||||||
|
|
||||||
|
@ -817,8 +829,6 @@ function highlightEntryFromUrl() {
|
||||||
, 2000 / 2 - entry.center[1]// + container.offsetTop
|
, 2000 / 2 - entry.center[1]// + container.offsetTop
|
||||||
]
|
]
|
||||||
|
|
||||||
//console.log(zoomOrigin)
|
|
||||||
|
|
||||||
closeObjectsListButton.classList.remove("d-none")
|
closeObjectsListButton.classList.remove("d-none")
|
||||||
entriesList.classList.add("disableHover")
|
entriesList.classList.add("disableHover")
|
||||||
|
|
||||||
|
@ -828,9 +838,6 @@ function highlightEntryFromUrl() {
|
||||||
hovered[0].element = infoElement
|
hovered[0].element = infoElement
|
||||||
updateLines()
|
updateLines()
|
||||||
fixed = true
|
fixed = true
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue