1
0
Fork 0
forked from Simnation/Main
Main/resources/[inventory]/pl_printer/web/index.html

167 lines
5.5 KiB
HTML
Raw Normal View History

2025-06-26 02:53:14 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<title></title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
2025-06-26 16:24:57 +02:00
background-color: transparent; /* Transparenter Hintergrund */
2025-06-26 15:57:52 +02:00
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
2025-06-26 02:53:14 +02:00
}
2025-06-26 04:08:54 +02:00
#image-container {
2025-06-26 15:57:52 +02:00
position: relative;
max-width: 80vw;
max-height: 80vh;
2025-06-26 04:08:54 +02:00
display: none;
2025-06-26 15:57:52 +02:00
overflow: auto; /* Ermöglicht Scrollen, wenn das Bild größer ist */
2025-06-26 04:08:54 +02:00
}
#image {
2025-06-26 15:57:52 +02:00
display: block;
2025-06-26 04:08:54 +02:00
max-width: 100%;
max-height: 100%;
2025-06-26 15:57:52 +02:00
object-fit: contain; /* Behält das Seitenverhältnis bei */
2025-06-26 04:08:54 +02:00
}
#document-id {
position: absolute;
bottom: 10px;
left: 10px;
color: white;
background-color: rgba(0, 0, 0, 0.5);
padding: 5px;
border-radius: 3px;
font-family: Arial, sans-serif;
2025-06-26 15:57:52 +02:00
}
/* Zoom-Kontrollen */
.zoom-controls {
position: absolute;
bottom: 10px;
right: 10px;
display: flex;
gap: 10px;
}
.zoom-btn {
background-color: rgba(0, 0, 0, 0.5);
color: white;
border: none;
border-radius: 3px;
padding: 5px 10px;
cursor: pointer;
font-family: Arial, sans-serif;
}
.zoom-btn:hover {
background-color: rgba(0, 0, 0, 0.7);
2025-06-26 02:53:14 +02:00
}
</style>
</head>
<body>
2025-06-26 04:08:54 +02:00
<div id="image-container">
<img id="image" src="" alt="Document">
<div id="document-id"></div>
2025-06-26 15:57:52 +02:00
<div class="zoom-controls">
<button class="zoom-btn" id="zoom-out">-</button>
<button class="zoom-btn" id="zoom-reset">Reset</button>
<button class="zoom-btn" id="zoom-in">+</button>
</div>
2025-06-26 04:08:54 +02:00
</div>
2025-06-26 02:53:14 +02:00
<script>
2025-06-26 15:57:52 +02:00
let currentZoom = 1;
const image = document.getElementById('image');
const zoomIn = document.getElementById('zoom-in');
const zoomOut = document.getElementById('zoom-out');
const zoomReset = document.getElementById('zoom-reset');
// Zoom-Funktionen
zoomIn.addEventListener('click', () => {
currentZoom += 0.1;
applyZoom();
});
zoomOut.addEventListener('click', () => {
currentZoom = Math.max(0.1, currentZoom - 0.1);
applyZoom();
});
zoomReset.addEventListener('click', () => {
currentZoom = 1;
applyZoom();
});
function applyZoom() {
image.style.transform = `scale(${currentZoom})`;
image.style.transformOrigin = 'center center';
}
2025-06-26 02:53:14 +02:00
window.addEventListener('message', function(event) {
if (event.data.action === 'show') {
2025-06-26 15:57:52 +02:00
// Zeige das spezifische Dokument basierend auf der ID oder URL
2025-06-26 02:53:14 +02:00
document.getElementById('image').src = event.data.imageUrl;
2025-06-26 04:08:54 +02:00
2025-06-26 15:57:52 +02:00
// Zeige optional die Dokument-ID an
if (event.data.documentId) {
2025-06-26 04:08:54 +02:00
document.getElementById('document-id').textContent = "Dokument: " + event.data.documentId;
}
document.getElementById('image-container').style.display = 'block';
2025-06-26 15:57:52 +02:00
// Reset zoom when showing a new image
currentZoom = 1;
applyZoom();
2025-06-26 04:08:54 +02:00
// Logge die Dokument-Informationen zur Fehlersuche
console.log("Dokument angezeigt:", event.data);
2025-06-26 02:53:14 +02:00
} else if (event.data.action === 'hide') {
2025-06-26 04:08:54 +02:00
document.getElementById('image-container').style.display = 'none';
2025-06-26 02:53:14 +02:00
}
});
document.addEventListener("keydown", function(event) {
2025-06-26 04:08:54 +02:00
if (event.key === "Escape") {
document.getElementById('image-container').style.display = 'none';
axios.post(`https://${GetParentResourceName()}/hideFrame`, {})
.then(function (response) {
console.log("Frame versteckt");
})
.catch(function (error) {
console.error("Fehler beim Verstecken des Frames:", error);
});
}
2025-06-26 15:57:52 +02:00
// Zoom mit Tastatur
else if (event.key === "+" || event.key === "=") {
currentZoom += 0.1;
applyZoom();
}
else if (event.key === "-" || event.key === "_") {
currentZoom = Math.max(0.1, currentZoom - 0.1);
applyZoom();
}
else if (event.key === "0") {
currentZoom = 1;
applyZoom();
}
});
// Mausrad-Zoom
document.getElementById('image-container').addEventListener('wheel', function(event) {
event.preventDefault();
if (event.deltaY < 0) {
// Zoom in
currentZoom += 0.1;
} else {
// Zoom out
currentZoom = Math.max(0.1, currentZoom - 0.1);
}
applyZoom();
2025-06-26 04:08:54 +02:00
});
2025-06-26 02:53:14 +02:00
</script>
</body>
</html>