@@ -383,7 +383,7 @@ export default {
383383 }
384384 try {
385385 await this .addPDF (this .initFileSrc )
386- this .selectedPageIndex = 0
386+ this .currentPage = 0
387387 fetchFont (this .currentFont )
388388 this .narrowEnlargeShow = true
389389 this .initTextField ()
@@ -398,17 +398,17 @@ export default {
398398 }
399399 },
400400 initTextField () {
401- if (this .selectedPageIndex < 0 || this .initTextFields === null || this .initTextFields .length === 0 ) {
401+ if (this .currentPage < 0 || this .initTextFields === null || this .initTextFields .length === 0 ) {
402402 return
403403 }
404404 for (let i = 0 ; i < this .pages .length ; i++ ) {
405- this .selectedPageIndex = i
405+ this .currentPage = i
406406 for (let j = 0 ; j < this .initTextFields .length ; j++ ) {
407407 // const text = this.initTextFields[j]
408- // this.addTextField(text, 0, j * 60, this.selectedPageIndex )
408+ // this.addTextField(text, 0, j * 60, this.currentPage )
409409 }
410410 }
411- this .selectedPageIndex = 0
411+ this .currentPage = 0
412412 const checker = setInterval (() => {
413413 // if (this.$refs.textItem.length === this.initTextFields.length * this.pages.length) {
414414 // document.getElementById('pdfBody').dispatchEvent(new MouseEvent('mousedown', {
@@ -422,11 +422,11 @@ export default {
422422
423423 },
424424 async initImages () {
425- if (this .selectedPageIndex < 0 ) {
425+ if (this .currentPage < 0 ) {
426426 return
427427 }
428428 for (let i = 0 ; i < this .pages .length ; i++ ) {
429- this .selectedPageIndex = i
429+ this .currentPage = i
430430 let y = 0
431431 if (this .initImageUrls !== null && this .initImageUrls .length !== 0 ) {
432432 // Need to initialize pictures
@@ -445,7 +445,7 @@ export default {
445445 await this .addImage (await res .blob (), 0 , (y + 1 ) * 100 , 0.4 , true )
446446 }
447447 }
448- this .selectedPageIndex = 0
448+ this .currentPage = 0
449449
450450 },
451451 onFinishDrawingCanvas (e ) {
@@ -470,11 +470,11 @@ export default {
470470 const files = e .target .files || (e .dataTransfer && e .dataTransfer .files )
471471 const file = files[0 ]
472472 if (! file || file .type !== ' application/pdf' ) return
473- this .selectedPageIndex = - 1
473+ this .currentPage = - 1
474474 try {
475475 await this .addPDF (file)
476476 this .narrowEnlargeShow = true
477- this .selectedPageIndex = 0
477+ this .currentPage = 0
478478 } catch (e) {
479479 console .log (e)
480480 }
@@ -524,7 +524,7 @@ export default {
524524 },
525525 async onUploadImage (e ) {
526526 const file = e .target .files [0 ]
527- if (file && this .selectedPageIndex >= 0 ) {
527+ if (file && this .currentPage >= 0 ) {
528528 await this .addImage (file)
529529 }
530530 e .target .value = null
@@ -544,7 +544,7 @@ export default {
544544
545545 const { canvasWidth , canvasHeight }
546546 = this .$refs [
547- ` page${ this .selectedPageIndex } `
547+ ` page${ this .currentPage } `
548548 ][0 ].getCanvasMeasurement ()
549549
550550 const object = {
@@ -568,12 +568,12 @@ export default {
568568 }
569569 },
570570 onAddTextField () {
571- if (this .selectedPageIndex >= 0 ) {
571+ if (this .currentPage >= 0 ) {
572572 this .addTextField ()
573573 }
574574 },
575575
576- addTextField (text = ' Please enter here' , x = 0 , y = 0 , currentPage = this .selectedPageIndex ) {
576+ addTextField (text = ' Please enter here' , x = 0 , y = 0 , currentPage = this .currentPage ) {
577577 const id = this .genID ()
578578 fetchFont (this .currentFont )
579579 const object = {
@@ -592,7 +592,7 @@ export default {
592592 },
593593
594594 onAddDrawing () {
595- if (this .selectedPageIndex >= 0 ) {
595+ if (this .currentPage >= 0 ) {
596596 this .addingDrawing = true
597597 }
598598 },
@@ -615,7 +615,7 @@ export default {
615615
616616 addObject (object ) {
617617 this .allObjects = this .allObjects .map ((objects , pIndex ) =>
618- pIndex === this .selectedPageIndex ? [... objects, object] : objects,
618+ pIndex === this .currentPage ? [... objects, object] : objects,
619619 )
620620 },
621621
@@ -626,12 +626,12 @@ export default {
626626 },
627627
628628 selectPage (index ) {
629- this .selectedPageIndex = index
629+ this .currentPage = index
630630 },
631631
632632 updateObject (objectId , payload ) {
633633 this .allObjects = this .allObjects .map ((objects , pIndex ) =>
634- pIndex === (payload .currentPage !== undefined ? payload .currentPage : this .selectedPageIndex )
634+ pIndex === (payload .currentPage !== undefined ? payload .currentPage : this .currentPage )
635635 ? objects .map (object =>
636636 object .id === objectId ? { ... object, ... payload } : object,
637637 )
@@ -641,7 +641,7 @@ export default {
641641
642642 deleteObject (objectId ) {
643643 this .allObjects = this .allObjects .map ((objects , pIndex ) =>
644- pIndex === this .selectedPageIndex
644+ pIndex === this .currentPage
645645 ? objects .filter (object => object .id !== objectId)
646646 : objects,
647647 )
0 commit comments