diff --git a/web/_js/main/draw.js b/web/_js/main/draw.js index 6f074a97..4403dc11 100644 --- a/web/_js/main/draw.js +++ b/web/_js/main/draw.js @@ -487,8 +487,8 @@ function initDraw() { function updateHovering(e, tapped) { if (!dragging && (!fixed || tapped)) { const pos = [ - (e.clientX - (container.clientWidth / 2 - innerContainer.clientWidth / 2 + zoomOrigin[0] + container.offsetLeft)) / zoom - , (e.clientY - (container.clientHeight / 2 - innerContainer.clientHeight / 2 + zoomOrigin[1] + container.offsetTop)) / zoom + (e.clientX - (container.clientWidth / 2 - innerContainer.clientWidth / 2 + zoomOrigin[0] + container.offsetLeft)) / zoom, + (e.clientY - (container.clientHeight / 2 - innerContainer.clientHeight / 2 + zoomOrigin[1] + container.offsetTop)) / zoom ] const coords_p = document.getElementById("coords_p") diff --git a/web/_js/main/stats.js b/web/_js/main/stats.js index c21a86dd..0a19f0a6 100644 --- a/web/_js/main/stats.js +++ b/web/_js/main/stats.js @@ -122,12 +122,12 @@ let linesDistance = 1 for (let i = 0; i <= Math.ceil((mostCounts / linesDistance) / 5) * 5; i++) { ctx.beginPath() ctx.moveTo( - 50 - , ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 + 50, + ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 ) ctx.lineTo( - el.width - 25 - , ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 + el.width - 25, + ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 ) ctx.stroke() } @@ -138,19 +138,19 @@ linesDistance = 5 for (let i = 0; i <= Math.ceil(mostCounts / linesDistance); i++) { ctx.beginPath() ctx.moveTo( - 50 - , ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 + 50, + ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 ) ctx.lineTo( - el.width - 25 - , ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 + el.width - 25, + ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 ) ctx.stroke() ctx.fillText( - i * linesDistance - , 40 - , ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 + i * linesDistance, + 40, + ~~(el.height - 50 - i * (linesDistance / mostCounts) * (el.height - 100)) + 0.5 ) } @@ -172,19 +172,19 @@ for (let i = 0; i <= counts.length; i++) { a++ ctx.beginPath() ctx.moveTo( - ~~(((i) / steps) * (el.width - 125) + 75) + 0.5 - , ~~(el.height - 50) + 0.5 + ~~(((i) / steps) * (el.width - 125) + 75) + 0.5, + ~~(el.height - 50) + 0.5 ) ctx.lineTo( - ~~(((i) / steps) * (el.width - 125) + 75) + 0.5 - , y + ~~(((i) / steps) * (el.width - 125) + 75) + 0.5, + y ) ctx.stroke() ctx.fillText( - (i) * (max / steps) - , ~~(((i) / steps) * (el.width - 125) + 75) - 0.5 - , y + 5 + (i) * (max / steps), + ~~(((i) / steps) * (el.width - 125) + 75) - 0.5, + y + 5 ) } } @@ -200,10 +200,10 @@ for (let i = 0; i < counts.length; i++) { } ctx.fillRect( - ~~((i / steps) * (el.width - 125) + 75) - , el.height - 50 - , Math.ceil(1 / steps * (el.width - 125)) - , ~~(-(counts[i] / mostCounts) * (el.height - 100)) + ~~((i / steps) * (el.width - 125) + 75), + el.height - 50, + Math.ceil(1 / steps * (el.width - 125)), + ~~(-(counts[i] / mostCounts) * (el.height - 100)) ) /*ctx.beginPath() diff --git a/web/_js/main/view.js b/web/_js/main/view.js index 5e2a3f53..ac563ca3 100644 --- a/web/_js/main/view.js +++ b/web/_js/main/view.js @@ -224,18 +224,18 @@ function updateLines() { // Align line based on which side the card is on if ((element.getBoundingClientRect().left + element.clientWidth / 2) < (document.documentElement.clientWidth / 2)) { linesContext.moveTo( - element.getBoundingClientRect().left + document.documentElement.scrollLeft + element.clientWidth - 5 - , element.getBoundingClientRect().top + document.documentElement.scrollTop + 20 + element.getBoundingClientRect().left + document.documentElement.scrollLeft + element.clientWidth - 5, + element.getBoundingClientRect().top + document.documentElement.scrollTop + 20 ) } else { linesContext.moveTo( - element.getBoundingClientRect().left + document.documentElement.scrollLeft + 5 - , element.getBoundingClientRect().top + document.documentElement.scrollTop + 20 + element.getBoundingClientRect().left + document.documentElement.scrollLeft + 5, + element.getBoundingClientRect().top + document.documentElement.scrollTop + 20 ) } linesContext.lineTo( - ~~(hovered[i].center[0] * zoom) + innerContainer.offsetLeft - , ~~(hovered[i].center[1] * zoom) + innerContainer.offsetTop + ~~(hovered[i].center[0] * zoom) + innerContainer.offsetLeft, + ~~(hovered[i].center[1] * zoom) + innerContainer.offsetTop ) linesContext.stroke() } @@ -254,18 +254,18 @@ function updateLines() { // Align line based on which side the card is on if ((element.getBoundingClientRect().left + element.clientWidth / 2) < (document.documentElement.clientWidth / 2)) { linesContext.moveTo( - element.getBoundingClientRect().left + document.documentElement.scrollLeft + element.clientWidth - 5 - , element.getBoundingClientRect().top + document.documentElement.scrollTop + 20 + element.getBoundingClientRect().left + document.documentElement.scrollLeft + element.clientWidth - 5, + element.getBoundingClientRect().top + document.documentElement.scrollTop + 20 ) } else { linesContext.moveTo( - element.getBoundingClientRect().left + document.documentElement.scrollLeft + 5 - , element.getBoundingClientRect().top + document.documentElement.scrollTop + 20 + element.getBoundingClientRect().left + document.documentElement.scrollLeft + 5, + element.getBoundingClientRect().top + document.documentElement.scrollTop + 20 ) } linesContext.lineTo( - ~~(hovered[i].center[0] * zoom) + innerContainer.offsetLeft - , ~~(hovered[i].center[1] * zoom) + innerContainer.offsetTop + ~~(hovered[i].center[0] * zoom) + innerContainer.offsetLeft, + ~~(hovered[i].center[1] * zoom) + innerContainer.offsetTop ) linesContext.stroke() } @@ -465,13 +465,13 @@ function buildObjectsList(filter = null, sort = null) { applyView() zoomOrigin = [ - innerContainer.clientWidth / 2 - this.entry.center[0] * zoom// + container.offsetLeft - , innerContainer.clientHeight / 2 - this.entry.center[1] * zoom// + container.offsetTop + innerContainer.clientWidth / 2 - this.entry.center[0] * zoom, // + container.offsetLeft + innerContainer.clientHeight / 2 - this.entry.center[1] * zoom // + container.offsetTop ] scaleZoomOrigin = [ - canvasCenter.x - this.entry.center[0] - , canvasCenter.y - this.entry.center[1] + canvasCenter.x - this.entry.center[0], + canvasCenter.y - this.entry.center[1] ] //console.log(zoomOrigin) @@ -508,13 +508,13 @@ function buildObjectsList(filter = null, sort = null) { updateHovering(e) zoomOrigin = [ - innerContainer.clientWidth / 2 - this.entry.center[0] * zoom// + container.offsetLeft - , innerContainer.clientHeight / 2 - this.entry.center[1] * zoom// + container.offsetTop + innerContainer.clientWidth / 2 - this.entry.center[0] * zoom// + container.offsetLeft, + innerContainer.clientHeight / 2 - this.entry.center[1] * zoom// + container.offsetTop ] scaleZoomOrigin = [ - 2000 / 2 - this.entry.center[0] - , 2000 / 2 - this.entry.center[1] + 2000 / 2 - this.entry.center[0], + 2000 / 2 - this.entry.center[1] ] previousZoomOrigin = [zoomOrigin[0], zoomOrigin[1]] @@ -684,8 +684,8 @@ function updateHovering(e, tapped) { if (!dragging && (!fixed || tapped)) { const pos = [ - (e.clientX - (container.clientWidth / 2 - innerContainer.clientWidth / 2 + zoomOrigin[0] + container.offsetLeft)) / zoom - , (e.clientY - (container.clientHeight / 2 - innerContainer.clientHeight / 2 + zoomOrigin[1] + container.offsetTop)) / zoom + (e.clientX - (container.clientWidth / 2 - innerContainer.clientWidth / 2 + zoomOrigin[0] + container.offsetLeft)) / zoom, + (e.clientY - (container.clientHeight / 2 - innerContainer.clientHeight / 2 + zoomOrigin[1] + container.offsetTop)) / zoom ] const coords_p = document.getElementById("coords_p") @@ -812,13 +812,13 @@ function highlightEntryFromUrl() { applyView() zoomOrigin = [ - innerContainer.clientWidth / 2 - entry.center[0] * zoom// + container.offsetLeft - , innerContainer.clientHeight / 2 - entry.center[1] * zoom// + container.offsetTop + innerContainer.clientWidth / 2 - entry.center[0] * zoom, // + container.offsetLeft + innerContainer.clientHeight / 2 - entry.center[1] * zoom // + container.offsetTop ] scaleZoomOrigin = [ - canvasCenter.x - entry.center[0] // + container.offsetLeft - , canvasCenter.y - entry.center[1] // + container.offsetTop + canvasCenter.x - entry.center[0], // + container.offsetLeft + canvasCenter.y - entry.center[1] // + container.offsetTop ] closeObjectsListButton.classList.remove("d-none") @@ -865,8 +865,8 @@ function initExplore() { function updateHovering(e, tapped) { if (!dragging && (!fixed || tapped)) { const pos = [ - (e.clientX - (container.clientWidth / 2 - innerContainer.clientWidth / 2 + zoomOrigin[0] + container.offsetLeft)) / zoom - , (e.clientY - (container.clientHeight / 2 - innerContainer.clientHeight / 2 + zoomOrigin[1] + container.offsetTop)) / zoom + (e.clientX - (container.clientWidth / 2 - innerContainer.clientWidth / 2 + zoomOrigin[0] + container.offsetLeft)) / zoom, + (e.clientY - (container.clientHeight / 2 - innerContainer.clientHeight / 2 + zoomOrigin[1] + container.offsetTop)) / zoom ] const coords_p = document.getElementById("coords_p") // Displays coordinates as zero instead of NaN @@ -905,16 +905,16 @@ function initGlobal() { function initViewGlobal() { container.addEventListener("mousedown", function (e) { lastPos = [ - e.clientX - , e.clientY + e.clientX, + e.clientY ] }) container.addEventListener("touchstart", function (e) { if (e.touches.length === 1) { lastPos = [ - e.touches[0].clientX - , e.touches[0].clientY + e.touches[0].clientX, + e.touches[0].clientY ] } }, { passive: true }) @@ -937,11 +937,9 @@ function initViewGlobal() { //console.log("Foo!!") dragging = false fixed = false - setTimeout( - function () { - updateHovering(e, true) - } - , 10) + setTimeout(function () { + updateHovering(e, true) + }, 10) } } })