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]) => { pathWithPeriodsTemp.forEach(([key, value]) => {
// TODO: Compress periods on something like 0-13, 14. // TODO: Compress periods on something like 0-13, 14.
exportObject.path[key] = value exportObject.path[key] = value.map(point => point.map(int => int + 0.5))
exportObject.center[key] = calculateCenter(value) exportObject.center[key] = calculateCenter(value).map(int => int + 0.5)
}) })
const inputWebsite = websiteGroupElements.map(element => element.value.trim()).filter(element => element) const inputWebsite = websiteGroupElements.map(element => element.value.trim()).filter(element => element)

View file

@ -516,39 +516,24 @@ async function init() {
function updateAtlasAll(atlas = atlasAll) { function updateAtlasAll(atlas = atlasAll) {
for (const atlasIndex in atlas) { for (const atlasIndex in atlas) {
if (Array.isArray(atlas[atlasIndex].path)) { const currentLinks = atlas[atlasIndex].links
const currentPath = atlas[atlasIndex].path atlas[atlasIndex].links = {
atlas[atlasIndex].path = {} website: [],
atlas[atlasIndex].path[defaultPeriod] = currentPath subreddit: [],
discord: [],
wiki: [],
...currentLinks
} }
if (Array.isArray(atlas[atlasIndex].center)) { const currentPath = atlas[atlasIndex].path
const currentCenter = atlas[atlasIndex].center const currentCenter = atlas[atlasIndex].center
atlas[atlasIndex].center = {} for (const key in currentPath) {
atlas[atlasIndex].center[defaultPeriod] = currentCenter currentPath[key] = currentPath[key].map(point => point.map(int => int + 0.5))
} }
if (atlas[atlasIndex].links) { for (const key in currentCenter) {
const currentLinks = atlas[atlasIndex].links currentCenter[key] = currentCenter[key].map(int => int + 0.5)
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
} }
atlas[atlasIndex].path = currentPath
atlas[atlasIndex].center = currentCenter
} }
return atlas return atlas
} }

File diff suppressed because one or more lines are too long