(item, monitor)
| 1526 | getSignerPos(item, monitor); |
| 1527 | }; |
| 1528 | const getSignerPos = (item, monitor) => { |
| 1529 | if (uniqueId) { |
| 1530 | const posZIndex = zIndex + 1; |
| 1531 | setZIndex(posZIndex); |
| 1532 | const key = randomId(); |
| 1533 | const containerScale = getContainerScale( |
| 1534 | pdfOriginalWH, |
| 1535 | pageNumber, |
| 1536 | containerWH |
| 1537 | ); |
| 1538 | let filterSignerPos, |
| 1539 | currentPagePosition, |
| 1540 | dropData = [], |
| 1541 | dropObj, |
| 1542 | placeHolder; |
| 1543 | filterSignerPos = signerPos?.find((data) => data.Id === uniqueId); |
| 1544 | const dragTypeValue = item?.text ? item.text : monitor.type; |
| 1545 | const widgetWidth = |
| 1546 | defaultWidthHeight(dragTypeValue).width * containerScale; |
| 1547 | const widgetHeight = |
| 1548 | defaultWidthHeight(dragTypeValue).height * containerScale; |
| 1549 | const extUser = localStorage.getItem("Extand_Class"); |
| 1550 | let parseUser = |
| 1551 | (extUser && JSON.parse(extUser)[0]) || |
| 1552 | JSON.parse(localStorage.getItem("signer")); |
| 1553 | |
| 1554 | const widgetValue = widgetDataValue(dragTypeValue, parseUser); |
| 1555 | //adding and updating drop position in array when user drop signature button in div |
| 1556 | if (item === "onclick") { |
| 1557 | // Use the current page container (id="container") so that the |
| 1558 | // height reflects one page, not the entire multi-page document. |
| 1559 | const containerEl = |
| 1560 | document.getElementById("container") || divRef.current; |
| 1561 | const divWidth = containerEl.getBoundingClientRect().width; |
| 1562 | const divHeight = containerEl.getBoundingClientRect().height; |
| 1563 | // Compute the pixel‐space center within the PDF viewport: |
| 1564 | const centerX_Pixels = divWidth / 2 - widgetWidth / 2; |
| 1565 | const xPosition_Final = centerX_Pixels / (containerScale * scale); |
| 1566 | dropObj = { |
| 1567 | //onclick put placeholder center on pdf |
| 1568 | xPosition: xPosition_Final, |
| 1569 | yPosition: |
| 1570 | (divHeight / 2 - widgetHeight / 2) / (containerScale * scale), |
| 1571 | isStamp: |
| 1572 | (dragTypeValue === "stamp" || dragTypeValue === "image") && true, |
| 1573 | key: key, |
| 1574 | scale: containerScale, |
| 1575 | zIndex: posZIndex, |
| 1576 | type: dragTypeValue, |
| 1577 | options: addWidgetOptions( |
| 1578 | dragTypeValue, |
| 1579 | owner, |
| 1580 | filterSignerPos?.placeHolder, |
| 1581 | null, |
| 1582 | widgetValue |
| 1583 | ), |
| 1584 | Width: widgetWidth / (containerScale * scale), |
| 1585 | Height: widgetHeight / (containerScale * scale) |
no test coverage detected