Added Location Prop

This commit is contained in:
2025-11-08 18:56:33 +01:00
parent 3a0c0fc9a7
commit 86a5b7e63e

View File

@@ -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