Leaflet.heat icon indicating copy to clipboard operation
Leaflet.heat copied to clipboard

Crashes when container has 0 width/height

Open thomasneirynck opened this issue 4 years ago • 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 https://github.com/elastic/kibana/issues/20423 in Kibana. Map widgets on a Kibana dashboard may have 0 width/height under certain conditions (e.g. during browser resizing).

thomasneirynck avatar Jul 30 '19 20:07 thomasneirynck

There is actually an open PR for this in simpleheat https://github.com/mourner/simpleheat/pull/34

thomasneirynck avatar Jul 30 '19 20:07 thomasneirynck

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

Dumbaz avatar Jun 18 '20 10:06 Dumbaz