Leaflet/Leaflet.heat

Crashes when container has 0 width/height

thomasneirynck opened this issue · 2 comments

Throws an uncaught error when the canvas 0 width/height. This can arise when the container for the canvas element has 0 width/height

This is due to https://github.com/mourner/simpleheat/blob/gh-pages/simpleheat.js#L114 in simpleheat. It's illegal to call getImageData with a 0 width/height.

From https://www.w3.org/TR/2dcontext2/#dom-context-2d-getimagedata

The getImageData(sx, sy, sw, sh) method must, if either the sw or sh arguments are zero, throw an IndexSizeError exception

This causes elastic/kibana#20423 in Kibana. Map widgets on a Kibana dashboard may have 0 width/height under certain conditions (e.g. during browser resizing).

There is actually an open PR for this in simpleheat mourner/simpleheat#34

Hi, is there an update on this one? We would appreciate this getting fixed :)