Added Location Prop
This commit is contained in:
@@ -14,11 +14,18 @@ const props = defineProps({
|
||||
type: Number,
|
||||
default: 1.2,
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
useLicense(config.public.pdfLicense)
|
||||
|
||||
const tempStore = useTempStore()
|
||||
|
||||
const pdfSrc = ref(null) // ObjectURL fürs Viewer
|
||||
const { $api } = useNuxtApp()
|
||||
|
||||
@@ -59,19 +66,26 @@ const currentScale = computed(() => {
|
||||
return zoomControl.value?.scale
|
||||
})
|
||||
|
||||
const handleZoomTool = (type) => {
|
||||
const handleZoomTool = (type, rawScale) => {
|
||||
console.log(type)
|
||||
const zoomCtrl = unref(zoomControl)
|
||||
if (!zoomCtrl) return
|
||||
|
||||
const scale = unref(currentScale)
|
||||
if (type === "in") {
|
||||
if(!type ){
|
||||
zoomCtrl.zoom(rawScale)
|
||||
} else if (type === "in") {
|
||||
scale && zoomCtrl.zoom(scale + 0.25)
|
||||
} else if (type === "out") {
|
||||
scale && zoomCtrl.zoom(scale - 0.25)
|
||||
} else {
|
||||
zoomCtrl.zoom(type)
|
||||
}
|
||||
|
||||
if(["in","out"].includes(type)){
|
||||
tempStore.modifySettings(`pdfviewer-scale-${props.location}`,scale)
|
||||
}
|
||||
|
||||
}
|
||||
//Page Control
|
||||
const pageControl = computed(() => vpvRef.value?.pageControl)
|
||||
@@ -196,6 +210,7 @@ watch(downloadControl, (downloadCtrl) => {
|
||||
style="height: 78vh; width: 100%;"
|
||||
:toolbar-options="false"
|
||||
ref="vpvRef"
|
||||
@loaded="handleZoomTool(null,tempStore.settings[`pdfviewer-scale-${props.location}`] || 1)"
|
||||
/>
|
||||
<div v-else>
|
||||
<UProgress
|
||||
|
||||
Reference in New Issue
Block a user