From 1eb181e7413e6708697b88bb6264fb9866fc9f68 Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Fri, 4 Jul 2025 04:47:37 +0200 Subject: [PATCH] added possibility for clicking image to make it bigger --- .../pages/AssetManagement/AssetManagement.css | 41 +++++++++++++++++ .../pages/AssetManagement/AssetManagement.js | 46 +++++++++++++++++-- 2 files changed, 84 insertions(+), 3 deletions(-) diff --git a/public/js/pages/AssetManagement/AssetManagement.css b/public/js/pages/AssetManagement/AssetManagement.css index a93cf1b79..ca0bb14c6 100644 --- a/public/js/pages/AssetManagement/AssetManagement.css +++ b/public/js/pages/AssetManagement/AssetManagement.css @@ -20,4 +20,45 @@ justify-content: center; color: #aaa; font-size: 24px; +} +/* CSS for the full-screen image overlay */ +.tt-fullscreen-image-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.8); + display: flex; + justify-content: center; + align-items: center; + z-index: 9999; + cursor: zoom-out; /* Indicate it's closable */ + /* Ensure it can receive keyboard events for 'esc' */ + outline: none; +} + +.tt-fullscreen-image { + max-width: 90%; + max-height: 90%; + object-fit: contain; + cursor: default; /* Change cursor back to default when over the image */ +} + +.tt-fullscreen-close-btn { + position: absolute; + top: 20px; + right: 20px; + background: none; + border: none; + color: white; + font-size: 30px; + cursor: pointer; + z-index: 10000; + padding: 0; + line-height: 1; +} + +.tt-fullscreen-close-btn:hover { + color: #f0f0f0; } \ No newline at end of file diff --git a/public/js/pages/AssetManagement/AssetManagement.js b/public/js/pages/AssetManagement/AssetManagement.js index a75786e6b..911fcb2cc 100644 --- a/public/js/pages/AssetManagement/AssetManagement.js +++ b/public/js/pages/AssetManagement/AssetManagement.js @@ -109,20 +109,60 @@ Vue.component('tt-asset-image', { props: { imageId: Number, }, + data() { + return { + isFullScreen: false, + }; + }, template: ` -
- +
+
+ +
+ +
`, methods: { onImageError(event) { event.target.src = 'https://placehold.co/60x60/eee/ccc?text=Error'; // Fallback placeholder + }, + openFullScreen() { + if (this.imageId) { // Only open if an image exists + this.isFullScreen = true; + this.$nextTick(() => { + if (this.$refs.fullScreenOverlay) { + this.$refs.fullScreenOverlay.focus(); // Focus the overlay to capture keydown events + } + }); + } + }, + closeFullScreen() { + this.isFullScreen = false; + } + }, + watch: { + isFullScreen(newVal) { + if (newVal) { + document.body.style.overflow = 'hidden'; // Prevent scrolling when full screen + } else { + document.body.style.overflow = ''; // Restore scrolling + } } } -}); +});; // =================================================================================