Skip to content

Crashes when container has 0 width/height #110

Description

@thomasneirynck

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions