grinat / leaflet-simple-map-screenshoter

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

get error "Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0." #51

Open amirsamani opened 11 months ago

amirsamani commented 11 months ago

hi i have below error when i want to take a screenshot with button click: "Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0."

`

document.getElementById('screenMapAndPast').addEventListener('click', function () {  simpleMapScreenshoter.takeScreen('image', { caption: function () { return 'Hello world' } }).then(image => { var img = document.createElement('img') img.src = image document.getElementById('screens').prepend(img) }).catch(e => { alert(e.toString()) }) })

`

raulsperoni commented 1 month ago

Hi, I'm having this error too... When I use the camera button of the map it works (tho with wierd black borders for each element). But in my custom function it throws this error.

Could you solve it?