earjhew
This commit is contained in:
parent
23dfccda04
commit
385dbcd6e5
@ -99,8 +99,8 @@ body {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
background: #0a0603;
|
background: #0a0603;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 100vw;
|
width: 100%; /* nicht 100vw – Firefox zieht Scrollbar ab */
|
||||||
height: 100vh;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -113,6 +113,7 @@ body {
|
|||||||
width: 2037px;
|
width: 2037px;
|
||||||
height: 1018px;
|
height: 1018px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
transform-origin: center center;
|
||||||
will-change: transform;
|
will-change: transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
33
public/js/map-scale.js
Normal file
33
public/js/map-scale.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/* ================================================
|
||||||
|
map-scale.js – Skaliert die Worldmap auf den
|
||||||
|
Viewport (cross-browser: Chrome, Firefox, Safari)
|
||||||
|
================================================ */
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
const MAP_W = 2037;
|
||||||
|
const MAP_H = 1018;
|
||||||
|
|
||||||
|
function scaleMap() {
|
||||||
|
const map = document.querySelector(".worldmap");
|
||||||
|
if (!map) return;
|
||||||
|
|
||||||
|
// window.innerWidth/Height = Viewport ohne Scrollbars, konsistent in
|
||||||
|
// Chrome, Firefox und Safari
|
||||||
|
const scale = Math.min(
|
||||||
|
window.innerWidth / MAP_W,
|
||||||
|
window.innerHeight / MAP_H
|
||||||
|
);
|
||||||
|
|
||||||
|
map.style.transform = `scale(${scale})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Beim Laden
|
||||||
|
if (document.readyState === "loading") {
|
||||||
|
document.addEventListener("DOMContentLoaded", scaleMap);
|
||||||
|
} else {
|
||||||
|
scaleMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bei Größenänderung (z.B. Zoom-Level-Wechsel im Browser)
|
||||||
|
window.addEventListener("resize", scaleMap);
|
||||||
|
})();
|
||||||
@ -96,6 +96,7 @@
|
|||||||
<link rel="stylesheet" href="/css/hud.css" />
|
<link rel="stylesheet" href="/css/hud.css" />
|
||||||
<link rel="stylesheet" href="/css/mine.css" />
|
<link rel="stylesheet" href="/css/mine.css" />
|
||||||
<script src="/js/heartbeat.js"></script>
|
<script src="/js/heartbeat.js"></script>
|
||||||
|
<script src="/js/map-scale.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user