Leaflet/Leaflet.heat

Exception on certain map state changes

Nithanaroy opened this issue · 5 comments

Message: "Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0."

Stack trace:

"Error: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.
    at Error (native)
    at Object.draw (http://0.0.0.0:8126/js/leaflet-heat/leaflet-heat.js:6:1414)
    at e._redraw (http://0.0.0.0:8126/js/leaflet-heat/leaflet-heat.js:11:2802)
    at e._reset (http://0.0.0.0:8126/js/leaflet-heat/leaflet-heat.js:11:1864)
    at e.fireEvent (http://0.0.0.0:8126/node_modules/leaflet/dist/leaflet.js:6:5055)
    at http://0.0.0.0:8126/node_modules/leaflet/dist/leaflet.js:6:513"

Local Variables
screen shot 2016-10-25 at 11 06 55 am

screen shot 2016-10-25 at 11 05 28 am

I get a similar case as when I create my maps they are of 0 size. And then get resized later in the lifecycle.
Is it possible to put some guards around the getImageData call when the width or height are 0 otherwise we trigger a throw.

Did you guys figure it out? I'm running into the same issue.

Same issue here