@@ -531,6 +531,7 @@ export function MapPage(props: MapPageProps) {
531531 }
532532
533533 setInProgress ( true ) ;
534+
534535 const caption = `${ isMobile
535536 ? currentMap . climatological_variable
536537 : labelFor ( currentMap . climatological_variable )
@@ -571,23 +572,27 @@ export function MapPage(props: MapPageProps) {
571572 //@ts -ignore
572573 navigator ?. userAgentData ?. platform . toLowerCase ( ) . indexOf ( 'linux' ) >= 0
573574 ? 'jpg'
574- : 'png '
575+ : 'jpg '
575576 } `;
576577 filename = filename . replaceAll ( '_' , '' ) ;
577- mapScreen
578- . takeScreen ( format , {
579- captionFontSize : isMobile ? 10 : 12 ,
580- screenName : `${ currentMap . climatological_variable } ` ,
581- caption : caption ,
582- } )
583- . then ( blob => {
584- setInProgress ( false ) ;
585- saveAs ( blob as Blob , filename ) ;
586- } )
587- . catch ( e => {
588- setInProgress ( false ) ;
589- console . error ( e ) ;
590- } ) ;
578+
579+ api . downloadScreenshot ( window . location . href , filename ) . then ( ( ) => {
580+ setInProgress ( false ) ;
581+ } ) ;
582+ //mapScreen
583+ // .takeScreen(format, {
584+ // captionFontSize: isMobile ? 10 : 12,
585+ // screenName: `${currentMap.climatological_variable}`,
586+ // caption: caption,
587+ // })
588+ // .then(blob => {
589+ // setInProgress(false);
590+ // saveAs(blob as Blob, filename);
591+ // })
592+ // .catch(e => {
593+ // setInProgress(false);
594+ // console.error(e);
595+ // });
591596 } ;
592597
593598 const openCharts = ( latLng : LatLng ) => {
@@ -611,36 +616,42 @@ export function MapPage(props: MapPageProps) {
611616
612617 return (
613618 < Box sx = { mapStyle } >
614- < Modal
615- open = { error . length > 0 }
616- onClose = { closeError }
617- aria-labelledby = "modal-modal-title"
618- aria-describedby = "modal-modal-description"
619- >
620- < Box sx = { modalStyle } >
621- < Typography id = "modal-modal-title" variant = "h6" component = "h2" >
622- { t ( error + '.title' ) }
623- </ Typography >
624- < Typography id = "modal-modal-description" sx = { { mt : 2 } } >
625- { t ( error + '.message' ) }
626- </ Typography >
627- < Button onClick = { closeError } > Ok</ Button >
619+ { currentMap . op !== 'screenshot' ? (
620+ < Box >
621+ < Modal
622+ open = { error . length > 0 }
623+ onClose = { closeError }
624+ aria-labelledby = "modal-modal-title"
625+ aria-describedby = "modal-modal-description"
626+ >
627+ < Box sx = { modalStyle } >
628+ < Typography id = "modal-modal-title" variant = "h6" component = "h2" >
629+ { t ( error + '.title' ) }
630+ </ Typography >
631+ < Typography id = "modal-modal-description" sx = { { mt : 2 } } >
632+ { t ( error + '.message' ) }
633+ </ Typography >
634+ < Button onClick = { closeError } > Ok</ Button >
635+ </ Box >
636+ </ Modal >
637+ < HeaderBar />
638+ < MapMenuBar
639+ onDownloadMapImg = { handleDownloadMapImg }
640+ mode = { map_mode }
641+ data = { map_data }
642+ menus = { menus }
643+ combinations = { combinations }
644+ onMenuChange = { updateCurrentMap }
645+ current_map = { currentMap }
646+ foundLayers = { foundLayers }
647+ setCurrentMap = { setCurrentMap }
648+ openError = { openError }
649+ inProgress = { inProgress }
650+ />
628651 </ Box >
629- </ Modal >
630- < HeaderBar />
631- < MapMenuBar
632- onDownloadMapImg = { handleDownloadMapImg }
633- mode = { map_mode }
634- data = { map_data }
635- menus = { menus }
636- combinations = { combinations }
637- onMenuChange = { updateCurrentMap }
638- current_map = { currentMap }
639- foundLayers = { foundLayers }
640- setCurrentMap = { setCurrentMap }
641- openError = { openError }
642- inProgress = { inProgress }
643- />
652+ ) : (
653+ < > </ >
654+ ) }
644655
645656 < Map
646657 onReady = { handleMapReady }
0 commit comments