askbot-dragon 1.4.34 → 1.4.35

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": "askbot-dragon",
3
- "version": "1.4.34",
3
+ "version": "1.4.35",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -287,28 +287,51 @@ export default {
287
287
  }
288
288
  if (this.fisrtLoad) {
289
289
  setTimeout(() => {
290
- // (this.pageSize.height + this.PAGE_INTVERVAL)
291
- if (this.$refs.pdfView.clientHeight - (this.pageSize.height + this.PAGE_INTVERVAL) > 0 ) {
292
- let loadNum = Math.ceil(this.$refs.pdfView.clientHeight / (this.pageSize.height + this.PAGE_INTVERVAL))
290
+ let pageoffsetHeight = 0
291
+ if(this.transformSalce !== null) {
292
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
293
+ } else {
294
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
295
+ }
296
+ if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0) {
297
+ let loadNum = Math.ceil(this.$refs.pdfView.clientHeight / pageoffsetHeight)
293
298
  for (let n = 0; n < loadNum; n++) {
294
299
  this.loadPdfData(pageNo + n)
295
300
  }
296
301
  }
297
- if(this.transformSalce !== null) {
298
- if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) * this.transformSalce ) {
299
- this.fisrtLoad = false
300
- } else {
301
- this.$refs.pdfView.scrollTop = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce)}`
302
- this.fisrtLoad = false
303
- }
302
+ if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * pageoffsetHeight)) {
303
+ this.fisrtLoad = false
304
304
  } else {
305
- if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL))) {
306
- this.fisrtLoad = false
307
- } else {
308
- this.$refs.pdfView.scrollTop = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL))}`
309
- this.fisrtLoad = false
310
- }
305
+ this.$refs.pdfView.scrollTop = `${((pageNo - 1) * pageoffsetHeight)}`
306
+ this.fisrtLoad = false
311
307
  }
308
+ // if(this.transformSalce !== null) {
309
+ // if (this.$refs.pdfView.clientHeight - (this.pageSize.height + this.PAGE_INTVERVAL) > 0 ) {
310
+ // let loadNum = Math.ceil(this.$refs.pdfView.clientHeight / (this.pageSize.height + this.PAGE_INTVERVAL))
311
+ // for (let n = 0; n < loadNum; n++) {
312
+ // this.loadPdfData(pageNo + n)
313
+ // }
314
+ // }
315
+ // if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) * this.transformSalce ) {
316
+ // this.fisrtLoad = false
317
+ // } else {
318
+ // this.$refs.pdfView.scrollTop = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce)}`
319
+ // this.fisrtLoad = false
320
+ // }
321
+ // } else {
322
+ // if (this.$refs.pdfView.clientHeight - (this.pageSize.height + this.PAGE_INTVERVAL) > 0 ) {
323
+ // let loadNum = Math.ceil(this.$refs.pdfView.clientHeight / (this.pageSize.height + this.PAGE_INTVERVAL))
324
+ // for (let n = 0; n < loadNum; n++) {
325
+ // this.loadPdfData(pageNo + n)
326
+ // }
327
+ // }
328
+ // if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL))) {
329
+ // this.fisrtLoad = false
330
+ // } else {
331
+ // this.$refs.pdfView.scrollTop = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL))}`
332
+ // this.fisrtLoad = false
333
+ // }
334
+ // }
312
335
  this.renderHighlights()
313
336
  // zoomElement(this.contentView)
314
337
  }, 100)
@@ -325,21 +348,29 @@ export default {
325
348
  const scrollTop = e.target.scrollTop;
326
349
  const height = e.target.clientHeight;
327
350
  // 根据内容可视区域中心点计算页码, 没有滚动时,指向第一页
328
- const pageIndex = scrollTop > 0 ?
329
- Math.ceil((scrollTop + (height / 2)) / (that.pageSize.height + that.PAGE_INTVERVAL)) :
330
- 1;
331
- // const startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
332
- // const endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL)) + 1
333
- // for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
334
- // console.log(startNum, endNum, pageIndex,'pageIndexpageIndexpageIndex');
335
- // if(pageIndex - 1 >= 0 || pageIndex + 1 < that.totalPageCount.length) {
336
- // that.loadPdfData(pageIndex)
337
- // }
338
- // }
351
+ // const pageIndex = scrollTop > 0 ?
352
+ // Math.ceil((scrollTop + (height / 2)) / (that.pageSize.height + that.PAGE_INTVERVAL)) :
353
+ // 1;
354
+ let startNum = 0
355
+ let endNum = 0
356
+
339
357
  // console.log(pageIndex);
340
- pageIndex - 1 != 0 && that.loadPdfData(pageIndex - 1)
341
- that.loadPdfData(pageIndex)
342
- pageIndex + 1 < that.totalPageCount.length && that.loadPdfData(pageIndex + 1)
358
+ if(this.transformSalce !== null) {
359
+ startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
360
+ endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
361
+ } else {
362
+ startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
363
+ endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
364
+ }
365
+ for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
366
+ console.log(pageIndex,pageIndex >= 0 && pageIndex <= that.pages.length, 'pageIndexpageIndexpageIndex');
367
+ if(pageIndex >= 0 && pageIndex <= that.pages.length) {
368
+ that.loadPdfData(pageIndex)
369
+ }
370
+ }
371
+ // pageIndex - 1 != 0 && that.loadPdfData(pageIndex - 1)
372
+ // that.loadPdfData(pageIndex)
373
+ // pageIndex + 1 < that.totalPageCount.length && that.loadPdfData(pageIndex + 1)
343
374
  }, 200),
344
375
  directScrolling (e, that) {
345
376
  if (this.fisrtLoad) {