File tree Expand file tree Collapse file tree 4 files changed +45
-11
lines changed Expand file tree Collapse file tree 4 files changed +45
-11
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
3
- function BorderResize ( { right, top } ) {
3
+ function BorderResize ( props ) {
4
+ const getHeight = ( ) => {
5
+ const height = props . posHeight ( props . pos , props . isSignYourself ) ;
6
+ if ( height > 14 ) {
7
+ return "14px" ;
8
+ } else {
9
+ return `${ height } px` ;
10
+ }
11
+ } ;
12
+
4
13
return (
5
14
< div
6
- className = { `${ right ? `-right-[12px]` : "-right-[1px]" } ${
7
- top ? `-bottom-[11px]` : "-bottom-[1px]"
8
- } absolute inline-block w-[14px] h-[14px] hover:cursor-sw-resize border-r-[3px] border-b-[3px] border-[#188ae2]`}
15
+ style = { {
16
+ width : getHeight ( ) || "14px" ,
17
+ height : getHeight ( ) || "14px"
18
+ } }
19
+ className = { `${ props . right ? `-right-[12px]` : "-right-[2px]" } ${
20
+ props . top ? `-bottom-[12px]` : "-bottom-[2px] "
21
+ } absolute inline-block hover:cursor-sw-resize border-r-[3px] border-b-[3px] border-[#188ae2]`}
9
22
> </ div >
10
23
) ;
11
24
}
Original file line number Diff line number Diff line change @@ -791,12 +791,22 @@ function Placeholder(props) {
791
791
props . pos . type !== radioButtonWidget &&
792
792
props . pos . type !== "checkbox" &&
793
793
props . pos . key === props . selectWidgetId ? (
794
- < BorderResize right = { - 12 } top = { - 11 } />
794
+ < BorderResize
795
+ right = { - 12 }
796
+ top = { - 11 }
797
+ pos = { props . pos }
798
+ posHeight = { props . posHeight }
799
+ isSignYourself = { props . isSignYourself }
800
+ />
795
801
) : props . data && props . isNeedSign && props . pos . type !== "checkbox" ? (
796
802
props . data ?. signerObjId === props . signerObjId &&
797
803
props . pos . type !== radioButtonWidget &&
798
804
props . pos . type !== "checkbox" ? (
799
- < BorderResize />
805
+ < BorderResize
806
+ posHeight = { props . posHeight }
807
+ isSignYourself = { props . isSignYourself }
808
+ pos = { props . pos }
809
+ />
800
810
) : (
801
811
< > </ >
802
812
)
@@ -862,6 +872,7 @@ function Placeholder(props) {
862
872
startDate = { startDate }
863
873
handleSaveDate = { handleSaveDate }
864
874
xPos = { props . xPos }
875
+ posHeight = { props . posHeight }
865
876
/>
866
877
</ div >
867
878
) : (
@@ -889,6 +900,7 @@ function Placeholder(props) {
889
900
startDate = { startDate }
890
901
handleSaveDate = { handleSaveDate }
891
902
xPos = { props . xPos }
903
+ posHeight = { props . posHeight }
892
904
/>
893
905
</ >
894
906
) }
Original file line number Diff line number Diff line change @@ -29,7 +29,9 @@ function PlaceholderType(props) {
29
29
const [ textValue , setTextValue ] = useState ( ) ;
30
30
const [ selectedCheckbox , setSelectedCheckbox ] = useState ( [ ] ) ;
31
31
const years = range ( 1990 , getYear ( new Date ( ) ) + 16 , 1 ) ;
32
- const fontSize = ( props . pos . options ?. fontSize || "12" ) + "px" ;
32
+ const height = props . posHeight ( props . pos , props . isSignYourself ) ;
33
+ const fontSize =
34
+ ( props . pos . options ?. fontSize || ( height > 14 ? 12 : height / 2 ) ) + "px" ;
33
35
const fontColor = props . pos . options ?. fontColor || "black" ;
34
36
const months = [
35
37
"January" ,
Original file line number Diff line number Diff line change @@ -1283,8 +1283,14 @@ export const changeImageWH = async (base64Image) => {
1283
1283
} ;
1284
1284
1285
1285
//function to calculate font size of text area widgets
1286
- const calculateFontSize = ( position , containerScale , signyourself ) => {
1287
- const font = position ?. options ?. fontSize || 12 ;
1286
+ const calculateFontSize = (
1287
+ position ,
1288
+ containerScale ,
1289
+ signyourself ,
1290
+ widgetHeight
1291
+ ) => {
1292
+ const font =
1293
+ position ?. options ?. fontSize || widgetHeight > 14 ? 12 : widgetHeight / 2 ;
1288
1294
if ( ! signyourself && position ?. isMobile && position ?. scale ) {
1289
1295
return font / position ?. scale / containerScale ;
1290
1296
} else {
@@ -1480,7 +1486,8 @@ export const multiSignEmbed = async (
1480
1486
const fontSize = calculateFontSize (
1481
1487
position ,
1482
1488
containerScale ,
1483
- signyourself
1489
+ signyourself ,
1490
+ widgetHeight
1484
1491
) ;
1485
1492
parseInt ( fontSize ) ;
1486
1493
let textContent ;
@@ -1655,7 +1662,7 @@ export const multiSignEmbed = async (
1655
1662
} ) ;
1656
1663
}
1657
1664
const pdfBytes = await pdfDoc . saveAsBase64 ( { useObjectStreams : false } ) ;
1658
- //console.log("pdf", pdfBytes);
1665
+ // console.log("pdf", pdfBytes);
1659
1666
return pdfBytes ;
1660
1667
} ;
1661
1668
You can’t perform that action at this time.
0 commit comments