added pixelDensity recalculation on window resize

This commit is contained in:
2025-01-05 18:22:43 +01:00
parent c97d17b7a6
commit 667dc0da8a
2 changed files with 8 additions and 1 deletions
+8
View File
@@ -33,6 +33,11 @@ function clampNearest(n, mul) {
}
function lerp(x, y, t) {
return x + t * (y - x)
}
function toggleGrid() {
if (gridVisible) {
document.getElementById("gridCanvas").remove()
@@ -109,6 +114,7 @@ document.addEventListener("DOMContentLoaded", async function() {
setLoadingProgress("Calculating pixel density...")
calcPixelDensity()
console.log("pxDensity: " + getComputedStyle(document.body).getPropertyValue("--pxDensity"))
switch (CURRENT_PAGE) {
case (PAGES.SYNTHWAVE): loadingScreenSynthwave()
@@ -126,6 +132,8 @@ document.addEventListener("DOMContentLoaded", async function() {
window.addEventListener("resize", () => {
calcPixelDensity()
switch (CURRENT_PAGE) {
case (PAGES.SYNTHWAVE): onResizeSynthWave()
}
-1
View File
@@ -11,6 +11,5 @@ function calcPixelDensity() {
pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity"))
console.log("pxDensity: " + getComputedStyle(document.body).getPropertyValue("--pxDensity"))
pxDensityDefined = true
}