grinat / leaflet-simple-map-screenshoter

Leaflet plugin which take screenshot of map
MIT License
71 stars 19 forks source link

Using Mapbox results in partial map only being captured & remaining area is white. #55

Open bangpradyumna opened 9 months ago

bangpradyumna commented 9 months ago

Hello, I recently replaced the map from OpenStreetMap to custom Mapbox layer and the screenshots are getting randomly screwed up. The map shows perfectly on my screen but sometimes when I capture screenshot, it is only partially visible with rest part of the image showing in solid white color, Please see that below:

image

The code was working perfectly with OpenStreetMap for a long time, the issue only started after switching to mapbox and this issue only appears during screenshot capture.

Here's the code snippet I'm using:

const overridedPluginOptions = {
                            mimeType: "image/jpeg",
                        };

simpleMapScreenshoter
                                .takeScreen("image", overridedPluginOptions)
                                .then((blob) => {
                                    FileSaver.saveAs(blob, 'screen.jpg')
                                })
                                .catch((e) => {
                                    console.error(e);
                                })
                                .then(() => {
                                    // Do something 
                                });