From afade924e7d9393429995abe7b857602f6c0ca8f Mon Sep 17 00:00:00 2001 From: Jannik Streek Date: Mon, 4 Dec 2023 17:17:09 +0100 Subject: [PATCH] export missing png bug on safari workaround --- teammapper-frontend/mmp/src/map/handlers/export.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/teammapper-frontend/mmp/src/map/handlers/export.ts b/teammapper-frontend/mmp/src/map/handlers/export.ts index 2507596f..653780bb 100644 --- a/teammapper-frontend/mmp/src/map/handlers/export.ts +++ b/teammapper-frontend/mmp/src/map/handlers/export.ts @@ -71,7 +71,9 @@ export default class Export { if (typeof type === 'string') { type = 'image/' + type } - + // Safari seems to have an issue with loading all included images on time during the download of the data url. + // This is a small workaround, as calling toBlob before seems to solve the problem most of the times. + if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) canvas.toBlob(() => {}) callback(canvas.toDataURL(type)) this.map.events.call(Event.exportImage) }