From b9c9a315efce8bddf765c62352c0966595b31c46 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Tue, 30 Jul 2024 12:31:26 +0530 Subject: Removed download svg button. --- src/scripts/functionality/sheet-map/index.ts | 34 ++++++---------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'src/scripts/functionality') diff --git a/src/scripts/functionality/sheet-map/index.ts b/src/scripts/functionality/sheet-map/index.ts index e76650e..c3ad13f 100644 --- a/src/scripts/functionality/sheet-map/index.ts +++ b/src/scripts/functionality/sheet-map/index.ts @@ -34,17 +34,13 @@ const createHeaderButton = (text: string) => { }; const setPlotInformation = (plotPolygon: PlotPolygon | null | undefined = null) => { - if (plotPolygon) { - plotInformation.innerHTML = getPlotInformationElement({ - area: (plotPolygon.plotArea/1000).toFixed(3), - plotNumber: plotPolygon.plotno - }); - } else { - plotInformation.innerHTML = getPlotInformationElement({ - area: "0.000", - plotNumber: "" - }); - } + plotInformation.innerHTML = plotPolygon ? getPlotInformationElement({ + area: (plotPolygon.plotArea/1000).toFixed(3), + plotNumber: plotPolygon.plotno + }) : getPlotInformationElement({ + area: "0.000", + plotNumber: "" + }); }; const downloadPDF = (labelPoints: boolean = true) => { @@ -56,24 +52,9 @@ const downloadPDF = (labelPoints: boolean = true) => { ); }; -const downloadSVGButton = createHeaderButton("SAVE SVG"); const downloadPDFButton = createHeaderButton("SAVE PDF"); const downloadPDFNoLabelButton = createHeaderButton("SAVE PDF (NO LABEL)"); -downloadSVGButton.addEventListener("click", e => { - e.preventDefault(); - const element = document.createElement("a"); - element.setAttribute( - "href", - "data:text/plain;charset=utf-8," + encodeURIComponent(plotPolygonPathElements + plotNumberLabelTextElements) - ); - element.setAttribute("download", "map.svg"); - element.style.display = "none"; - document.body.appendChild(element); - element.click(); - document.body.removeChild(element); -}); - downloadPDFButton.addEventListener("click", e => { e.preventDefault(); downloadPDF(); @@ -118,7 +99,6 @@ setPlotInformation(); }); } - downloadSVGButton.style.display = "inherit"; downloadPDFButton.style.display = "inherit"; downloadPDFNoLabelButton.style.display = "inherit"; -- cgit v1.2.3