Remove decimals on path and center, remove unused code

This commit is contained in:
Hans5958 2022-05-17 19:33:31 +07:00
parent 5c9afec733
commit f92901af74
3 changed files with 8121 additions and 8136 deletions

View file

@ -270,8 +270,8 @@ function initDraw() {
pathWithPeriodsTemp.forEach(([key, value]) => {
// TODO: Compress periods on something like 0-13, 14.
exportObject.path[key] = value
exportObject.center[key] = calculateCenter(value)
exportObject.path[key] = value.map(point => point.map(int => int + 0.5))
exportObject.center[key] = calculateCenter(value).map(int => int + 0.5)
})
const inputWebsite = websiteGroupElements.map(element => element.value.trim()).filter(element => element)

View file

@ -516,39 +516,24 @@ async function init() {
function updateAtlasAll(atlas = atlasAll) {
for (const atlasIndex in atlas) {
if (Array.isArray(atlas[atlasIndex].path)) {
const currentPath = atlas[atlasIndex].path
atlas[atlasIndex].path = {}
atlas[atlasIndex].path[defaultPeriod] = currentPath
const currentLinks = atlas[atlasIndex].links
atlas[atlasIndex].links = {
website: [],
subreddit: [],
discord: [],
wiki: [],
...currentLinks
}
if (Array.isArray(atlas[atlasIndex].center)) {
const currentCenter = atlas[atlasIndex].center
atlas[atlasIndex].center = {}
atlas[atlasIndex].center[defaultPeriod] = currentCenter
const currentPath = atlas[atlasIndex].path
const currentCenter = atlas[atlasIndex].center
for (const key in currentPath) {
currentPath[key] = currentPath[key].map(point => point.map(int => int + 0.5))
}
if (atlas[atlasIndex].links) {
const currentLinks = atlas[atlasIndex].links
atlas[atlasIndex].links = {
website: [],
subreddit: [],
discord: [],
wiki: [],
...currentLinks
}
} else {
atlas[atlasIndex].links = {
website: [],
subreddit: [],
discord: [],
wiki: []
}
if (atlas[atlasIndex].website) atlas[atlasIndex].links.website = [atlas[atlasIndex].website]
if (atlas[atlasIndex].subreddit) atlas[atlasIndex].links.subreddit = atlas[atlasIndex].subreddit.split(',').map(subreddit => subreddit.trim().replace(/^\/r\//, ''))
delete atlas[atlasIndex].website
delete atlas[atlasIndex].subreddit
for (const key in currentCenter) {
currentCenter[key] = currentCenter[key].map(int => int + 0.5)
}
atlas[atlasIndex].path = currentPath
atlas[atlasIndex].center = currentCenter
}
return atlas
}

File diff suppressed because one or more lines are too long