93 lines
1.9 KiB
Vue
93 lines
1.9 KiB
Vue
<template>
|
|
<div class="context-menu-overlay" @click.self="$emit('close')">
|
|
<div class="context-menu" :style="{ top: `${position.y}px`, left: `${position.x}px` }">
|
|
<div class="context-menu-image-preview">
|
|
<img :src="image.path" :alt="'Selected Image ' + image.name" />
|
|
</div>
|
|
<ul>
|
|
<li @click="$emit('print', image)">Drucken</li>
|
|
<li @click="$emit('changeStyle', image)">Stil ändern</li>
|
|
<li @click="$emit('close')">Schließen</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
const props = defineProps({
|
|
position: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
image: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
});
|
|
|
|
const emits = defineEmits(['close', 'print', 'changeStyle']);
|
|
</script>
|
|
|
|
<style scoped>
|
|
.context-menu-overlay {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rgba(0, 0, 0, 0.5); /* Halbdurchsichtiger Hintergrund */
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
z-index: 999;
|
|
}
|
|
|
|
.context-menu {
|
|
background: white;
|
|
border: 1px solid #ccc;
|
|
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
|
|
z-index: 1000;
|
|
display: flex;
|
|
flex-direction: row; /* Bild und Menü nebeneinander */
|
|
max-width: 80%;
|
|
max-height: 80%;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.context-menu-image-preview {
|
|
flex: 1; /* Nimmt den verfügbaren Platz ein */
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 10px;
|
|
}
|
|
|
|
.context-menu-image-preview img {
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.context-menu ul {
|
|
list-style: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
border-left: 1px solid #eee; /* Trennlinie zwischen Bild und Menü */
|
|
min-width: 150px; /* Mindestbreite für das Menü */
|
|
}
|
|
|
|
.context-menu li {
|
|
padding: 15px;
|
|
cursor: pointer;
|
|
font-size: 1.1em;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.context-menu li:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.context-menu li:hover {
|
|
background: #f0f0f0;
|
|
}
|
|
</style> |