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