@meistrari/tela-build 1.25.2 → 1.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useEventListener, useScroll } from '@vueuse/core'
|
|
2
|
+
import { useThrottleFn, useEventListener, useScroll } from '@vueuse/core'
|
|
3
3
|
import { cn } from '@/lib/utils'
|
|
4
4
|
import type { PreviewFile, PreviewContentLabels, PdfDocumentHandle } from './types'
|
|
5
5
|
|
|
@@ -116,12 +116,14 @@ let isRendering = false
|
|
|
116
116
|
let pendingReRender = false
|
|
117
117
|
let pendingScrollPage: number | null = null
|
|
118
118
|
|
|
119
|
+
const throttledReRender = useThrottleFn(reRenderAllPdfPages, 150, true)
|
|
120
|
+
|
|
119
121
|
function zoomIn() {
|
|
120
122
|
if (scale.value < 3) {
|
|
121
123
|
scale.value = Math.min(scale.value + 0.25, 3)
|
|
122
124
|
|
|
123
125
|
if (props.file.fileType === 'application/pdf') {
|
|
124
|
-
|
|
126
|
+
throttledReRender()
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
}
|
|
@@ -131,11 +133,10 @@ function zoomOut() {
|
|
|
131
133
|
scale.value = Math.max(scale.value - 0.25, 0.5)
|
|
132
134
|
|
|
133
135
|
if (props.file.fileType === 'application/pdf') {
|
|
134
|
-
|
|
136
|
+
throttledReRender()
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
}
|
|
138
|
-
|
|
139
140
|
function clearCanvasElement(canvas: HTMLCanvasElement | null | undefined) {
|
|
140
141
|
if (!canvas)
|
|
141
142
|
return
|