-
-
Notifications
You must be signed in to change notification settings - Fork 253
Expand file tree
/
Copy pathAnnotationSelectionMenu.vue
More file actions
60 lines (54 loc) · 1.39 KB
/
AnnotationSelectionMenu.vue
File metadata and controls
60 lines (54 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script setup lang="ts">
import { useAnnotationCapability } from '@embedpdf/plugin-annotation/vue';
import type { TrackedAnnotation } from '@embedpdf/plugin-annotation';
import type { MenuWrapperProps } from '@embedpdf/utils/vue';
import type { Rect } from '@embedpdf/models';
interface AnnotationSelectionMenuProps {
menuWrapperProps: MenuWrapperProps;
annotation: TrackedAnnotation;
rect: Rect;
}
const props = defineProps<AnnotationSelectionMenuProps>();
const { provides: annotation } = useAnnotationCapability();
const handleDelete = (e: Event) => {
e.stopPropagation();
const api = annotation.value;
if (!api) return;
const { pageIndex, id } = props.annotation.object;
api.deleteAnnotation(pageIndex, id);
};
</script>
<template>
<span v-bind="menuWrapperProps">
<q-card
flat
bordered
class="menu-card q-pa-xs"
:style="{
position: 'absolute',
top: `${rect.size.height + 8}px`,
left: '0',
zIndex: 1000,
cursor: 'default',
pointerEvents: 'auto',
}"
>
<div class="row items-center q-gutter-xs">
<q-btn
flat
round
dense
size="sm"
icon="mdi-delete-outline"
@click="handleDelete"
aria-label="Delete annotation"
/>
</div>
</q-card>
</span>
</template>
<style scoped>
.menu-card {
min-width: 40px;
}
</style>