@@ -348,7 +348,8 @@ export const multiSignEmbed = async (
348
348
pngUrl ,
349
349
pdfDoc ,
350
350
pdfOriginalWidth ,
351
- signyourself
351
+ signyourself ,
352
+ containerWH
352
353
) => {
353
354
for ( let i = 0 ; i < pngUrl . length ; i ++ ) {
354
355
const pageNo = pngUrl [ i ] . pageNumber ;
@@ -385,12 +386,12 @@ export const multiSignEmbed = async (
385
386
const imgHeight = imgUrlList [ id ] . Height ? imgUrlList [ id ] . Height : 60 ;
386
387
const imgWidth = imgUrlList [ id ] . Width ? imgUrlList [ id ] . Width : 150 ;
387
388
const isMobile = window . innerWidth < 767 ;
388
- const newWidth = window . innerWidth - 32 ;
389
+ const newWidth = containerWH . width ;
389
390
const scale = isMobile ? pdfOriginalWidth / newWidth : 1 ;
390
391
const xPos = ( pos ) => {
391
392
if ( signyourself ) {
392
393
if ( isMobile ) {
393
- return imgUrlList [ id ] . xPosition * scale + 43 ;
394
+ return imgUrlList [ id ] . xPosition * scale ;
394
395
} else {
395
396
return imgUrlList [ id ] . xPosition ;
396
397
}
@@ -400,15 +401,15 @@ export const multiSignEmbed = async (
400
401
//if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale
401
402
if ( pos . isMobile ) {
402
403
const x = pos . xPosition * ( pos . scale / scale ) ;
403
- return x * scale + 50 ;
404
+ return x * scale ;
404
405
} else {
405
406
const x = pos . xPosition / scale ;
406
407
return x * scale ;
407
408
}
408
409
} else {
409
410
//else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale
410
411
if ( pos . isMobile ) {
411
- const x = pos . xPosition * pos . scale + 50 ;
412
+ const x = pos . xPosition * pos . scale ;
412
413
return x ;
413
414
} else {
414
415
return pos . xPosition ;
@@ -435,9 +436,9 @@ export const multiSignEmbed = async (
435
436
//if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale
436
437
if ( pos . isMobile ) {
437
438
const y = pos . yPosition * ( pos . scale / scale ) ;
438
- return page . getHeight ( ) - y * scale - imgHeight ;
439
+ return page . getHeight ( ) - y * scale - imgHeight * scale ;
439
440
} else {
440
- return page . getHeight ( ) - y * scale - imgHeight ;
441
+ return page . getHeight ( ) - y * scale - imgHeight * scale ;
441
442
}
442
443
} else {
443
444
//else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale
@@ -519,6 +520,7 @@ export const handleImageResize = (
519
520
const getPosData = getXYdata ;
520
521
const addSignPos = getPosData . map ( ( url , ind ) => {
521
522
if ( url . key === key ) {
523
+ console . log ( "url" , url ) ;
522
524
return {
523
525
...url ,
524
526
Width : ! url . isMobile ? ref . offsetWidth * scale : ref . offsetWidth ,
@@ -592,22 +594,29 @@ export const handleSignYourselfImageResize = (
592
594
position ,
593
595
xyPostion ,
594
596
index ,
595
- setXyPostion
597
+ setXyPostion ,
598
+ pdfOriginalWidth ,
599
+ containerWH
596
600
) => {
597
601
const updateFilter = xyPostion [ index ] . pos . filter (
598
602
( data ) => data . key === key && data . Width && data . Height
599
603
) ;
604
+ // console.log(" position.x", position.x)
605
+ const isMobile = window . innerWidth < 767 ;
606
+ const newWidth = containerWH ;
607
+ const scale = isMobile ? pdfOriginalWidth / newWidth : 1 ;
600
608
601
609
if ( updateFilter . length > 0 ) {
602
610
const getXYdata = xyPostion [ index ] . pos ;
603
611
const getPosData = getXYdata ;
604
612
const addSign = getPosData . map ( ( url , ind ) => {
605
613
if ( url . key === key ) {
614
+ console . log ( "url" , url ) ;
606
615
return {
607
616
...url ,
608
- Width : ref . offsetWidth ,
609
- Height : ref . offsetHeight ,
610
- xPosition : position . x
617
+ Width : ! url . isMobile ? ref . offsetWidth * scale : ref . offsetWidth ,
618
+ Height : ! url . isMobile ? ref . offsetHeight * scale : ref . offsetHeight ,
619
+ xPosition : position . xpos
611
620
} ;
612
621
}
613
622
return url ;
@@ -630,8 +639,8 @@ export const handleSignYourselfImageResize = (
630
639
if ( url . key === key ) {
631
640
return {
632
641
...url ,
633
- Width : ref . offsetWidth ,
634
- Height : ref . offsetHeight
642
+ Width : ! url . isMobile ? ref . offsetWidth * scale : ref . offsetWidth ,
643
+ Height : ! url . isMobile ? ref . offsetHeight * scale : ref . offsetHeight
635
644
} ;
636
645
}
637
646
return url ;
0 commit comments