diff --git a/microfrontends/SignDocuments/src/Component/DebugUi.js b/microfrontends/SignDocuments/src/Component/DebugUi.js index 39237fd59..3423abd04 100644 --- a/microfrontends/SignDocuments/src/Component/DebugUi.js +++ b/microfrontends/SignDocuments/src/Component/DebugUi.js @@ -1,13 +1,14 @@ -import React, { useEffect, useState, useRef } from "react"; +import React, { useEffect, useState } from "react"; import RenderAllPdfPage from "./component/renderAllPdfPage"; import "../css/./signature.css"; -import { pdfNewWidthFun } from "../utils/Utils"; import "../css/AddUser.css"; import Title from "./component/Title"; import ModalUi from "../premitives/ModalUi"; import RenderDebugPdf from "./component/RenderDebugPdf"; import { pdfjs } from "react-pdf"; import Alert from "../premitives/Alert"; +import HandleError from "./component/HandleError"; +import { useWindowSize } from "../hook/useWindowSize"; function processDimensions(x, y, width, height) { if (width < 0) { @@ -28,15 +29,11 @@ function processDimensions(x, y, width, height) { }; } const DebugUi = () => { - const divRef = useRef(null); - const isMobile = window.innerWidth < 767; + const { width } = useWindowSize(); const [pdf, setPdf] = useState(""); const [isModal, setIsModal] = useState(true); const [allPages, setAllPages] = useState(null); const [pageNumber, setPageNumber] = useState(1); - const [pdfNewWidth, setPdfNewWidth] = useState(); - const [containerWH, setContainerWH] = useState(); - const [pdfOriginalWidth, setPdfOriginalWidth] = useState(); const [pdfLoadFail, setPdfLoadFail] = useState({ status: false, type: "load" @@ -51,21 +48,10 @@ const DebugUi = () => { base64: "" }); const [hoverCoordinates, setHoverCoordinates] = useState({ x: 0, y: 0 }); - const [drawing, setDrawing] = useState(false); const [pdfDimension, setPdfDimension] = useState({ width: 0, height: 0 }); const [annotations, setAnnotations] = useState([]); const [newAnnotation, setNewAnnotation] = useState([]); const [copied, setCopied] = useState(false); - useEffect(() => { - if (divRef.current) { - const pdfWidth = pdfNewWidthFun(divRef); - setPdfNewWidth(pdfWidth); - setContainerWH({ - width: divRef.current.offsetWidth, - height: divRef.current.offsetHeight - }); - } - }, [divRef.current]); useEffect(() => { if (pdf && pdf.name) { @@ -233,207 +219,209 @@ const DebugUi = () => {
+ ) : (
+ <>
+ {!isModal && (
+
+ {` ["page":${coord?.page}, "x": ${coord.x}, "y": ${coord.y}, "w": ${coord.width}, "h": ${coord.height}]`}
+
+