Skip to content

Commit 7e5ebed

Browse files
authored
Merge pull request #158 from LibreSign/feature/add-scale-events
feature: add scale events
2 parents 3755e3f + 36a303b commit 7e5ebed

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@libresign/vue-pdf-editor",
33
"description": "vue2 pdf editor component",
4-
"version": "1.4.8",
4+
"version": "1.5.0",
55
"author": "LibreCode",
66
"private": false,
77
"main": "dist/vue-pdf-editor.umd.js",

src/VuePdfEditor.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,16 @@ export default {
318318
type: Boolean,
319319
default: false,
320320
},
321+
initialScale: {
322+
type: Number,
323+
default: 1,
324+
},
321325
},
322326
data() {
323327
return {
324328
wheelZoomCount: 0,
325329
narrowEnlargeShow: false,
326-
scale: 1,
330+
scale: this.initialScale,
327331
pdfFile: null,
328332
pdfName: '',
329333
numPages: null,
@@ -340,6 +344,11 @@ export default {
340344
}
341345
},
342346
watch: {
347+
scale(newScale, oldScale) {
348+
if (newScale !== oldScale) {
349+
this.$emit('scale-changed', newScale)
350+
}
351+
},
343352
},
344353
async mounted() {
345354
await this.init()
@@ -386,6 +395,9 @@ export default {
386395
fetchFont(this.currentFont)
387396
this.narrowEnlargeShow = true
388397
this.initTextField()
398+
this.$nextTick(() => {
399+
this.$emit('pdf-editor:ready')
400+
})
389401
} catch (e) {
390402
console.log(e)
391403
}

0 commit comments

Comments
 (0)