mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-11-15 22:43:13 +01:00
Remove console log comments
This commit is contained in:
parent
7543af3d9a
commit
02a6ad3499
5 changed files with 0 additions and 51 deletions
|
@ -251,10 +251,6 @@ function initDraw() {
|
||||||
|
|
||||||
const pathWithPeriodsTemp = pathWithPeriods.concat()
|
const pathWithPeriodsTemp = pathWithPeriods.concat()
|
||||||
|
|
||||||
// console.log(pathWithPeriodsTemp)
|
|
||||||
|
|
||||||
// calculateCenter(path)
|
|
||||||
|
|
||||||
for (let i = pathWithPeriodsTemp.length - 1; i > 0; i--) {
|
for (let i = pathWithPeriodsTemp.length - 1; i > 0; i--) {
|
||||||
for (let j = 0; j < i; j++) {
|
for (let j = 0; j < i; j++) {
|
||||||
if (JSON.stringify(pathWithPeriodsTemp[i][1]) === JSON.stringify(pathWithPeriodsTemp[j][1])) {
|
if (JSON.stringify(pathWithPeriodsTemp[i][1]) === JSON.stringify(pathWithPeriodsTemp[j][1])) {
|
||||||
|
@ -485,7 +481,6 @@ function initDraw() {
|
||||||
|
|
||||||
periodsAdd.addEventListener('click', () => {
|
periodsAdd.addEventListener('click', () => {
|
||||||
pathWithPeriods.push([defaultPeriod, []])
|
pathWithPeriods.push([defaultPeriod, []])
|
||||||
// console.log(JSON.stringify(pathWithPeriods))
|
|
||||||
initPeriodGroups()
|
initPeriodGroups()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -501,8 +496,6 @@ function initPeriodGroups() {
|
||||||
periodGroupElements = []
|
periodGroupElements = []
|
||||||
periodGroups.textContent = ''
|
periodGroups.textContent = ''
|
||||||
|
|
||||||
// console.log(pathWithPeriods)
|
|
||||||
|
|
||||||
pathWithPeriods.forEach(([period, path], index) => {
|
pathWithPeriods.forEach(([period, path], index) => {
|
||||||
const periodGroupEl = periodGroupTemplate.cloneNode(true)
|
const periodGroupEl = periodGroupTemplate.cloneNode(true)
|
||||||
periodGroupEl.id = "periodGroup" + index
|
periodGroupEl.id = "periodGroup" + index
|
||||||
|
@ -516,7 +509,6 @@ function initPeriodGroups() {
|
||||||
const periodCopyEl = periodGroupEl.querySelector('.period-copy')
|
const periodCopyEl = periodGroupEl.querySelector('.period-copy')
|
||||||
|
|
||||||
const [start, end, variation] = parsePeriod(period)
|
const [start, end, variation] = parsePeriod(period)
|
||||||
// console.log(period, start, end, variation)
|
|
||||||
|
|
||||||
startPeriodEl.id = "periodStart" + index
|
startPeriodEl.id = "periodStart" + index
|
||||||
startPeriodEl.previousSibling.for = startPeriodEl.id
|
startPeriodEl.previousSibling.for = startPeriodEl.id
|
||||||
|
@ -534,12 +526,10 @@ function initPeriodGroups() {
|
||||||
startPeriodEl.addEventListener('input', event => {
|
startPeriodEl.addEventListener('input', event => {
|
||||||
timelineSlider.value = parseInt(event.target.value)
|
timelineSlider.value = parseInt(event.target.value)
|
||||||
updateTime(parseInt(event.target.value), variation)
|
updateTime(parseInt(event.target.value), variation)
|
||||||
// console.log(parseInt(event.target.value))
|
|
||||||
})
|
})
|
||||||
endPeriodEl.addEventListener('input', event => {
|
endPeriodEl.addEventListener('input', event => {
|
||||||
timelineSlider.value = parseInt(event.target.value)
|
timelineSlider.value = parseInt(event.target.value)
|
||||||
updateTime(parseInt(event.target.value), variation)
|
updateTime(parseInt(event.target.value), variation)
|
||||||
// console.log(parseInt(event.target.value))
|
|
||||||
})
|
})
|
||||||
periodDeleteEl.addEventListener('click', () => {
|
periodDeleteEl.addEventListener('click', () => {
|
||||||
if (pathWithPeriods.length === 1) return
|
if (pathWithPeriods.length === 1) return
|
||||||
|
@ -558,7 +548,6 @@ function initPeriodGroups() {
|
||||||
endPeriodEl.value = newVariationConfig.default
|
endPeriodEl.value = newVariationConfig.default
|
||||||
endPeriodEl.max = newVariationConfig.versions.length - 1
|
endPeriodEl.max = newVariationConfig.versions.length - 1
|
||||||
updateTime(newVariationConfig.default, newVariation)
|
updateTime(newVariationConfig.default, newVariation)
|
||||||
// console.log(parseInt(event.target.value))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
periodCopyEl.addEventListener("click", event => {
|
periodCopyEl.addEventListener("click", event => {
|
||||||
|
@ -575,7 +564,6 @@ function initPeriodGroups() {
|
||||||
updatePeriodGroups()
|
updatePeriodGroups()
|
||||||
} else if (event.target.textContent === "Paste") {
|
} else if (event.target.textContent === "Paste") {
|
||||||
pathWithPeriods[index][1] = [...periodClipboard.path]
|
pathWithPeriods[index][1] = [...periodClipboard.path]
|
||||||
// console.log(pathWithPeriods[index])
|
|
||||||
if (pathWithPeriods.length > 2) console.log(pathWithPeriods[2])
|
if (pathWithPeriods.length > 2) console.log(pathWithPeriods[2])
|
||||||
initPeriodGroups()
|
initPeriodGroups()
|
||||||
}
|
}
|
||||||
|
@ -601,14 +589,12 @@ function initPeriodGroups() {
|
||||||
periodCopyEl
|
periodCopyEl
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// console.log(periodGroupTemplate)
|
|
||||||
|
|
||||||
updatePeriodGroups()
|
updatePeriodGroups()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePeriodGroups() {
|
function updatePeriodGroups() {
|
||||||
// console.log('updatePeriodGroups')
|
|
||||||
let pathToActive = []
|
let pathToActive = []
|
||||||
let lastActivePathIndex
|
let lastActivePathIndex
|
||||||
let currentActivePathIndex
|
let currentActivePathIndex
|
||||||
|
@ -649,9 +635,6 @@ function updatePeriodGroups() {
|
||||||
if (periodClipboard.index !== null) {
|
if (periodClipboard.index !== null) {
|
||||||
if (index !== periodClipboard.index) {
|
if (index !== periodClipboard.index) {
|
||||||
periodCopyEl.textContent = "Paste"
|
periodCopyEl.textContent = "Paste"
|
||||||
// console.log(JSON.stringify(pathWithPeriods[index][1]))
|
|
||||||
// console.log(JSON.stringify(periodClipboard.path))
|
|
||||||
// console.log(JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path))
|
|
||||||
if (JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path)) {
|
if (JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path)) {
|
||||||
periodCopyEl.disabled = true
|
periodCopyEl.disabled = true
|
||||||
} else {
|
} else {
|
||||||
|
@ -666,19 +649,8 @@ function updatePeriodGroups() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// console.log('updatePeriodGroups searcher', pathToActive, lastActivePathIndex, currentActivePathIndex, period)
|
|
||||||
|
|
||||||
periodsStatus.textContent = ""
|
periodsStatus.textContent = ""
|
||||||
|
|
||||||
// if (currentActivePathIndexes.length > 1) {
|
|
||||||
// periodsStatus.textContent = "Collision detected! Please resolve it."
|
|
||||||
// currentActivePathIndexes.forEach(index => {
|
|
||||||
// periodGroupElements[index].periodGroupEl.dataset.status = "error"
|
|
||||||
// })
|
|
||||||
// currentActivePathIndex = undefined
|
|
||||||
// }
|
|
||||||
|
|
||||||
// console.log(lastActivePathIndex)
|
|
||||||
if (lastActivePathIndex !== undefined) {
|
if (lastActivePathIndex !== undefined) {
|
||||||
if (lastActivePathIndex === currentActivePathIndex) {
|
if (lastActivePathIndex === currentActivePathIndex) {
|
||||||
// just update the path
|
// just update the path
|
||||||
|
@ -706,7 +678,6 @@ function updatePeriodGroups() {
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// console.log('direct active', pathToActive)
|
|
||||||
updatePath(pathToActive)
|
updatePath(pathToActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,9 +694,7 @@ function formatPeriod(start, end, variation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePath(newPath) {
|
function updatePath(newPath) {
|
||||||
// console.log('updatePath', path, newPath)
|
|
||||||
if (newPath) path = newPath
|
if (newPath) path = newPath
|
||||||
// console.log('updatePath', path, newPath)
|
|
||||||
if (path.length > 3) center = calculateCenter(path)
|
if (path.length > 3) center = calculateCenter(path)
|
||||||
render(path)
|
render(path)
|
||||||
undoButton.disabled = path.length == 0; // Maybe make it undo the cancel action in the future
|
undoButton.disabled = path.length == 0; // Maybe make it undo the cancel action in the future
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function createInfoBlock(entry) {
|
function createInfoBlock(entry) {
|
||||||
// console.log(entry)
|
|
||||||
function createInfoParagraph(name, value) {
|
function createInfoParagraph(name, value) {
|
||||||
const entryParagraphPositionElement = document.createElement("p");
|
const entryParagraphPositionElement = document.createElement("p");
|
||||||
const nameElement = document.createElement("span");
|
const nameElement = document.createElement("span");
|
||||||
|
|
|
@ -143,7 +143,6 @@ async function init() {
|
||||||
const liveResp = await fetch("https://place-atlas.stefanocoding.me/atlas.json");
|
const liveResp = await fetch("https://place-atlas.stefanocoding.me/atlas.json");
|
||||||
let liveJson = await liveResp.json();
|
let liveJson = await liveResp.json();
|
||||||
liveJson = updateAtlasAll(liveJson)
|
liveJson = updateAtlasAll(liveJson)
|
||||||
// console.log(liveJson)
|
|
||||||
|
|
||||||
const liveAtlasReduced = liveJson.reduce(function (a, c) {
|
const liveAtlasReduced = liveJson.reduce(function (a, c) {
|
||||||
a[c.id] = c;
|
a[c.id] = c;
|
||||||
|
|
|
@ -114,7 +114,6 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren
|
||||||
currentUpdateIndex++
|
currentUpdateIndex++
|
||||||
const myUpdateIndex = currentUpdateIndex
|
const myUpdateIndex = currentUpdateIndex
|
||||||
currentPeriod = newPeriod
|
currentPeriod = newPeriod
|
||||||
// console.log(newPeriod, newVariation)
|
|
||||||
const variationConfig = variationsConfig[newVariation]
|
const variationConfig = variationsConfig[newVariation]
|
||||||
if (currentVariation !== newVariation) {
|
if (currentVariation !== newVariation) {
|
||||||
currentVariation = newVariation
|
currentVariation = newVariation
|
||||||
|
@ -156,11 +155,9 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren
|
||||||
}))
|
}))
|
||||||
for await (const url of configObject.url) {
|
for await (const url of configObject.url) {
|
||||||
const imageLayer = new Image()
|
const imageLayer = new Image()
|
||||||
// console.log(imageCache[url])
|
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
imageLayer.onload = () => {
|
imageLayer.onload = () => {
|
||||||
context.drawImage(imageLayer, 0, 0)
|
context.drawImage(imageLayer, 0, 0)
|
||||||
// console.log("image done")
|
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
imageLayer.src = imageCache[url]
|
imageLayer.src = imageCache[url]
|
||||||
|
@ -169,7 +166,6 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren
|
||||||
|
|
||||||
if (currentUpdateIndex !== myUpdateIndex) return [configObject, newPeriod, newVariation]
|
if (currentUpdateIndex !== myUpdateIndex) return [configObject, newPeriod, newVariation]
|
||||||
const blob = await new Promise(resolve => canvas.toBlob(resolve))
|
const blob = await new Promise(resolve => canvas.toBlob(resolve))
|
||||||
// console.log(URL.createObjectURL(blob))
|
|
||||||
image.src = URL.createObjectURL(blob)
|
image.src = URL.createObjectURL(blob)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,15 +184,11 @@ async function updateTime(newPeriod = currentPeriod, newVariation = currentVaria
|
||||||
|
|
||||||
const validPeriods2 = Object.keys(atlasAll[atlasIndex].path)
|
const validPeriods2 = Object.keys(atlasAll[atlasIndex].path)
|
||||||
|
|
||||||
// console.log(chosenIndex)
|
|
||||||
|
|
||||||
for (const i in validPeriods2) {
|
for (const i in validPeriods2) {
|
||||||
const validPeriods = validPeriods2[i].split(', ')
|
const validPeriods = validPeriods2[i].split(', ')
|
||||||
for (const j in validPeriods) {
|
for (const j in validPeriods) {
|
||||||
const [start, end, variation] = parsePeriod(validPeriods[j])
|
const [start, end, variation] = parsePeriod(validPeriods[j])
|
||||||
// console.log(start, end, variation, newPeriod, newVariation)
|
|
||||||
if (isOnPeriod(start, end, variation, newPeriod, newVariation)) {
|
if (isOnPeriod(start, end, variation, newPeriod, newVariation)) {
|
||||||
// console.log("match", start, end, variation, newPeriod, newVariation, i)
|
|
||||||
chosenIndex = i
|
chosenIndex = i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -204,25 +196,18 @@ async function updateTime(newPeriod = currentPeriod, newVariation = currentVaria
|
||||||
if (chosenIndex !== undefined) break
|
if (chosenIndex !== undefined) break
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(testMatches)
|
|
||||||
|
|
||||||
// console.log(chosenIndex)
|
|
||||||
if (chosenIndex === undefined) continue
|
if (chosenIndex === undefined) continue
|
||||||
pathChosen = Object.values(atlasAll[atlasIndex].path)[chosenIndex]
|
pathChosen = Object.values(atlasAll[atlasIndex].path)[chosenIndex]
|
||||||
centerChosen = Object.values(atlasAll[atlasIndex].center)[chosenIndex]
|
centerChosen = Object.values(atlasAll[atlasIndex].center)[chosenIndex]
|
||||||
|
|
||||||
if (pathChosen === undefined) continue
|
if (pathChosen === undefined) continue
|
||||||
|
|
||||||
// console.log(123)
|
|
||||||
|
|
||||||
atlas.push({
|
atlas.push({
|
||||||
...atlasAll[atlasIndex],
|
...atlasAll[atlasIndex],
|
||||||
path: pathChosen,
|
path: pathChosen,
|
||||||
center: centerChosen,
|
center: centerChosen,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// console.log(atlas)
|
|
||||||
|
|
||||||
dispatchTimeUpdateEvent(newPeriod, atlas)
|
dispatchTimeUpdateEvent(newPeriod, atlas)
|
||||||
document.body.dataset.canvasLoading = false
|
document.body.dataset.canvasLoading = false
|
||||||
}
|
}
|
||||||
|
@ -247,7 +232,6 @@ function isOnPeriod(start, end, variation, currentPeriod, currentVariation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function parsePeriod(periodString) {
|
function parsePeriod(periodString) {
|
||||||
// console.log(periodString)
|
|
||||||
let variation = "default"
|
let variation = "default"
|
||||||
periodString = periodString + ""
|
periodString = periodString + ""
|
||||||
if (periodString.split(':').length > 1) {
|
if (periodString.split(':').length > 1) {
|
||||||
|
|
|
@ -389,8 +389,6 @@ function buildObjectsList(filter = null, sort = null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// console.log(sortedAtlas[i])
|
|
||||||
const element = createInfoBlock(sortedAtlas[i]);
|
const element = createInfoBlock(sortedAtlas[i]);
|
||||||
|
|
||||||
element.entry = sortedAtlas[i];
|
element.entry = sortedAtlas[i];
|
||||||
|
|
Loading…
Reference in a new issue