-
-
Notifications
You must be signed in to change notification settings - Fork 250
Expand file tree
/
Copy pathzoom-gesture-wrapper.vue
More file actions
40 lines (36 loc) · 940 Bytes
/
zoom-gesture-wrapper.vue
File metadata and controls
40 lines (36 loc) · 940 Bytes
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
<template>
<div
ref="elementRef"
:style="{
display: 'inline-block',
overflow: 'visible',
boxSizing: 'border-box',
}"
v-bind="$attrs"
>
<slot />
</div>
</template>
<script setup lang="ts">
import { toRef } from 'vue';
import { useZoomGesture } from '../hooks/use-zoom-gesture';
interface Props {
documentId: string;
/** Enable pinch-to-zoom gesture (default: true) */
enablePinch?: boolean;
/** Enable wheel zoom with ctrl/cmd key (default: true) */
enableWheel?: boolean;
/** Override wheel zoom step; 0.1 = 10% (default: 0.1) */
zoomStep?: number;
}
const props = withDefaults(defineProps<Props>(), {
enablePinch: true,
enableWheel: true,
zoomStep: 0.1,
});
const { elementRef } = useZoomGesture(() => props.documentId, {
enablePinch: toRef(() => props.enablePinch),
enableWheel: toRef(() => props.enableWheel),
zoomStep: toRef(() => props.zoomStep),
});
</script>