141141 :origin-width =" object.originWidth"
142142 :origin-height =" object.originHeight"
143143 :page-scale =" pagesScale[pIndex]"
144- :page -width =" pageSizes[pIndex + 1].width "
145- :page -height =" pageSizes[pIndex + 1].height "
144+ :canvas -width =" object.canvasWidth "
145+ :canvas -height =" object.canvasHeight "
146146 @onUpdate =" updateObject(object.id, $event)"
147147 @onDelete =" deleteObject(object.id)" />
148148 </div >
159159 :font-family =" object.fontFamily"
160160 :current-page =" object.currentPage"
161161 :page-scale =" pagesScale[pIndex]"
162- :page -width =" pageSizes[pIndex + 1].width "
163- :page -height =" pageSizes[pIndex + 1].height "
162+ :canvas -width =" object.canvasWidth "
163+ :canvas -height =" object.canvasHeight "
164164 @onUpdate =" updateObject(object.id, $event)"
165165 @onDelete =" deleteObject(object.id)"
166166 @onSelectFont =" selectFontFamily" />
174174 :origin-width =" object.originWidth"
175175 :origin-height =" object.originHeight"
176176 :page-scale =" pagesScale[pIndex]"
177- :page -width =" pageSizes[pIndex + 1].width "
178- :page -height =" pageSizes[pIndex + 1].height "
177+ :canvas -width =" object.canvasWidth "
178+ :canvas -height =" object.canvasHeight "
179179 @onUpdate =" updateObject(object.id, $event)"
180180 @onDelete =" deleteObject(object.id)" />
181181 </div >
@@ -330,7 +330,6 @@ export default {
330330 pdfDocument: null ,
331331 pages: [],
332332 pagesScale: [],
333- pageSizes: [],
334333 allObjects: [],
335334 currentFont: ' Courier' ,
336335 focusId: null ,
@@ -481,7 +480,6 @@ export default {
481480 this .pdfDocument = null
482481 this .pages = []
483482 this .pagesScale = []
484- this .pageSizes = []
485483 this .allObjects = []
486484 },
487485 async addPDF (file ) {
@@ -525,7 +523,6 @@ export default {
525523 width: measurement[2 ],
526524 height: measurement[3 ],
527525 }
528- this .pageSizes [page .pageNumber ] = data .measurement [page .pageNumber ]
529526 })
530527 this .$emit (' pdf-editor:end-init' , data)
531528 }
@@ -568,8 +565,6 @@ export default {
568565 originHeight: height,
569566 canvasWidth,
570567 canvasHeight,
571- pageWidth: this .pageSizes [this .selectedPageIndex + 1 ].width ,
572- pageHeight: this .pageSizes [this .selectedPageIndex + 1 ].height ,
573568 x,
574569 y,
575570 isSealImage,
@@ -590,6 +585,12 @@ export default {
590585 addTextField (text = ' Please enter here' , x = 0 , y = 0 , currentPage = this .selectedPageIndex ) {
591586 const id = this .genID ()
592587 fetchFont (this .currentFont )
588+
589+ const { canvasWidth , canvasHeight }
590+ = this .$refs [
591+ ` page${ this .selectedPageIndex } `
592+ ][0 ].getCanvasMeasurement ()
593+
593594 const object = {
594595 id,
595596 text,
@@ -598,8 +599,8 @@ export default {
598599 width: 0 , // recalculate after editing
599600 lineHeight: 1.4 ,
600601 fontFamily: this .currentFont ,
601- pageWidth : this . pageSizes [currentPage + 1 ]. width ,
602- pageHeight : this . pageSizes [currentPage + 1 ]. height ,
602+ canvasWidth ,
603+ canvasHeight ,
603604 x,
604605 y,
605606 currentPage,
@@ -615,6 +616,12 @@ export default {
615616
616617 addDrawing (originWidth , originHeight , path , scale = 1 ) {
617618 const id = this .genID ()
619+
620+ const { canvasWidth , canvasHeight }
621+ = this .$refs [
622+ ` page${ this .selectedPageIndex } `
623+ ][0 ].getCanvasMeasurement ()
624+
618625 const object = {
619626 id,
620627 path,
@@ -625,6 +632,8 @@ export default {
625632 originHeight,
626633 width: originWidth * scale,
627634 height: originHeight * scale,
635+ canvasWidth,
636+ canvasHeight,
628637 scale,
629638 }
630639 this .addObject (object)
0 commit comments