More work on making flyers

This commit is contained in:
Pieter Vander Vennet 2022-09-12 20:14:03 +02:00
parent 9d753ec7c0
commit b9d5a1edff
8 changed files with 831 additions and 418 deletions

View file

@ -109,10 +109,26 @@ export default class MinimapImplementation extends BaseUIElement implements Mini
mp.remove()
}
public async TakeScreenshot() {
/**
* Takes a screenshot of the current map
* @param format: image: give a base64 encoded png image;
* @constructor
*/
public async TakeScreenshot(): Promise<string> ;
public async TakeScreenshot(format: "image"): Promise<string> ;
public async TakeScreenshot(format: "blob"): Promise<Blob> ;
public async TakeScreenshot(format: "image" | "blob"): Promise<string | Blob> ;
public async TakeScreenshot(format: "image" | "blob" = "image"): Promise<string | Blob> {
const screenshotter = new SimpleMapScreenshoter()
screenshotter.addTo(this.leafletMap.data)
return await screenshotter.takeScreen("image")
const result = <any> await screenshotter.takeScreen((<any> format) ?? "image")
if(format === "image" && typeof result === "string"){
return result
}
if(format === "blob" && result instanceof Blob){
return result
}
throw "Something went wrong while creating the screenshot: "+result
}
protected InnerConstructElement(): HTMLElement {