|
1 | 1 | <!-- ./extensions/layouts/super-layout-table/components/CellRenderers/ImageCell.vue --> |
2 | 2 | <template> |
3 | 3 | <div class="image-cell" :class="`align-${alignment || 'center'}`"> |
4 | | - <div |
5 | | - v-if="imageSrc" |
| 4 | + <div |
| 5 | + v-if="imageSrc" |
6 | 6 | class="image-wrapper" |
7 | 7 | @mouseenter="handleMouseEnter" |
8 | 8 | @mouseleave="showPreview = false" |
9 | 9 | > |
10 | 10 | <img :src="imageSrc" :alt="alt || 'Preview'" class="preview-image" @error="onImageError" /> |
11 | 11 | </div> |
12 | 12 | <span v-else class="image-empty">—</span> |
13 | | - |
| 13 | + |
14 | 14 | <!-- Hover preview außerhalb des Wrappers mit v-show --> |
15 | 15 | <Teleport to="body" v-if="imageSrc"> |
16 | | - <div |
17 | | - v-show="showPreview" |
| 16 | + <div |
| 17 | + v-show="showPreview" |
18 | 18 | class="image-hover-preview" |
19 | 19 | :style="previewStyle" |
20 | 20 | @mouseenter="showPreview = true" |
@@ -77,26 +77,26 @@ const previewStyle = computed(() => { |
77 | 77 | const previewHeight = 400; |
78 | 78 | const windowWidth = window.innerWidth; |
79 | 79 | const windowHeight = window.innerHeight; |
80 | | - |
| 80 | +
|
81 | 81 | let left = mouseX.value + offset; |
82 | | - let top = mouseY.value - (previewHeight / 2); // Vertikal zentriert zur Maus |
83 | | - |
| 82 | + let top = mouseY.value - previewHeight / 2; // Vertikal zentriert zur Maus |
| 83 | +
|
84 | 84 | // Wenn Preview rechts aus dem Fenster ragt, links von der Maus anzeigen |
85 | 85 | if (left + previewWidth > windowWidth - 20) { |
86 | 86 | left = mouseX.value - previewWidth - offset; |
87 | 87 | } |
88 | | - |
| 88 | +
|
89 | 89 | // Sicherstellen dass Preview nicht aus dem Fenster ragt |
90 | 90 | if (left < 20) left = 20; |
91 | 91 | if (top < 20) top = 20; |
92 | 92 | if (top + previewHeight > windowHeight - 20) { |
93 | 93 | top = windowHeight - previewHeight - 20; |
94 | 94 | } |
95 | | - |
| 95 | +
|
96 | 96 | return { |
97 | 97 | left: `${left}px`, |
98 | 98 | top: `${top}px`, |
99 | | - transform: 'none' // Kein transform mehr nötig |
| 99 | + transform: 'none', // Kein transform mehr nötig |
100 | 100 | }; |
101 | 101 | }); |
102 | 102 |
|
@@ -200,7 +200,7 @@ function onImageError() { |
200 | 200 | width: 80px; |
201 | 201 | height: 60px; |
202 | 202 | } |
203 | | - |
| 203 | +
|
204 | 204 | .image-hover-preview { |
205 | 205 | width: 300px; |
206 | 206 | height: 300px; |
|
0 commit comments