diff --git a/src/plugins/polar-plot/polar-plot.ts b/src/plugins/polar-plot/polar-plot.ts index d38dbaa7a..64279be86 100644 --- a/src/plugins/polar-plot/polar-plot.ts +++ b/src/plugins/polar-plot/polar-plot.ts @@ -42,8 +42,9 @@ export class PolarPlotPlugin extends KeepTrackPlugin { sideMenuElementName: string = 'polar-plot-menu'; sideMenuElementHtml: string = keepTrackApi.html`
-
+
+
`; @@ -57,6 +58,26 @@ export class PolarPlotPlugin extends KeepTrackPlugin { maxWidth: 1000, }; + addHtml(): void { + super.addHtml(); + + keepTrackApi.register({ + event: KeepTrackApiEvents.uiManagerFinal, + cbName: this.PLUGIN_NAME, + cb: () => { + getEl('polar-plot-save').addEventListener('click', () => { + const canvas = document.getElementById('polar-plot') as HTMLCanvasElement; + const image = canvas.toDataURL('image/png').replace('image/png', 'image/octet-stream'); + const link = document.createElement('a'); + + link.href = image; + link.download = `sat-${(this.selectSatManager_.getSelectedSat() as DetailedSatellite).sccNum6}-polar-plot.png`; + link.click(); + }); + }, + }); + } + addJs(): void { super.addJs();