dok/views/launcher-dev.ejs
2026-03-29 10:45:47 +01:00

55 lines
1.1 KiB
Plaintext

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<title>Map Developer</title>
<link rel="stylesheet" href="/css/global.css" />
<link rel="stylesheet" href="/css/launcher-dev.css" />
</head>
<body>
<div class="wrapper">
<img src="/images/dok_bg.png" id="map" />
<svg
id="overlay"
viewBox="0 0 2037 1018"
width="2037"
height="1018"
></svg>
</div>
<script>
let points = [];
const svg = document.getElementById("overlay");
svg.addEventListener("click", (e) => {
const rect = svg.getBoundingClientRect();
const x = Math.round(e.clientX - rect.left);
const y = Math.round(e.clientY - rect.top);
points.push(`${x},${y}`);
drawPolygon();
console.log('points="' + points.join(" ") + '"');
});
function drawPolygon() {
svg.innerHTML = `
<polygon points="${points.join(" ")}"></polygon>
`;
}
document.addEventListener("keydown", (e) => {
if (e.key === "Escape") {
points = [];
svg.innerHTML = "";
}
});
</script>
</body>
</html>