added pixelDensity recalculation on window resize
This commit is contained in:
@@ -33,6 +33,11 @@ function clampNearest(n, mul) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function lerp(x, y, t) {
|
||||||
|
return x + t * (y - x)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function toggleGrid() {
|
function toggleGrid() {
|
||||||
if (gridVisible) {
|
if (gridVisible) {
|
||||||
document.getElementById("gridCanvas").remove()
|
document.getElementById("gridCanvas").remove()
|
||||||
@@ -109,6 +114,7 @@ document.addEventListener("DOMContentLoaded", async function() {
|
|||||||
|
|
||||||
setLoadingProgress("Calculating pixel density...")
|
setLoadingProgress("Calculating pixel density...")
|
||||||
calcPixelDensity()
|
calcPixelDensity()
|
||||||
|
console.log("pxDensity: " + getComputedStyle(document.body).getPropertyValue("--pxDensity"))
|
||||||
|
|
||||||
switch (CURRENT_PAGE) {
|
switch (CURRENT_PAGE) {
|
||||||
case (PAGES.SYNTHWAVE): loadingScreenSynthwave()
|
case (PAGES.SYNTHWAVE): loadingScreenSynthwave()
|
||||||
@@ -126,6 +132,8 @@ document.addEventListener("DOMContentLoaded", async function() {
|
|||||||
|
|
||||||
|
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
|
calcPixelDensity()
|
||||||
|
|
||||||
switch (CURRENT_PAGE) {
|
switch (CURRENT_PAGE) {
|
||||||
case (PAGES.SYNTHWAVE): onResizeSynthWave()
|
case (PAGES.SYNTHWAVE): onResizeSynthWave()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,5 @@ function calcPixelDensity() {
|
|||||||
|
|
||||||
pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity"))
|
pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity"))
|
||||||
|
|
||||||
console.log("pxDensity: " + getComputedStyle(document.body).getPropertyValue("--pxDensity"))
|
|
||||||
pxDensityDefined = true
|
pxDensityDefined = true
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user