@toolspack/ttd-pdfjs 0.0.6 → 0.0.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolspack/ttd-pdfjs",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "private": false,
5
5
  "main": "lib/ttd-pdfjs.umd.min.js",
6
6
  "scripts": {
@@ -159,7 +159,7 @@ export default {
159
159
  const renderTask = await page.render(renderContext)
160
160
 
161
161
  // Wait for rendering to finish
162
- await renderTask.promise
162
+ renderTask.promise
163
163
  vm.pageRendering = false
164
164
  if (vm.pageNumPending !== null) {
165
165
  // New page rendering is pending
@@ -202,8 +202,10 @@ export default {
202
202
  if (this.pdfDoc) {
203
203
  if (this.viewport) {
204
204
  const { canvas } = this.$refs
205
- const cxt = canvas.getContext('2d')
206
- cxt.clearRect(0, 0, this.viewport.width, this.viewport.height);
205
+ if (canvas) {
206
+ const cxt = canvas.getContext('2d')
207
+ cxt.clearRect(0, 0, this.viewport.width, this.viewport.height);
208
+ }
207
209
  }
208
210
  this.viewport = null
209
211
  this.pdfDoc.destroy();
@@ -276,6 +278,10 @@ export default {
276
278
  // 这要通过调用 ondragover 事件的 event.preventDefault() 方法:
277
279
  event.preventDefault()
278
280
  },
281
+ updateScale() {
282
+ this.compuscale = this.scale
283
+ this.renderPage(this.pageNum)
284
+ },
279
285
  },
280
286
  mounted() {
281
287
  this.compuscale = this.scale