Secretmapper / react-image-annotation

An infinitely customizable image annotation library built on React
https://secretmapper.github.io/react-image-annotation/
MIT License
325 stars 135 forks source link

[BUG] PointSelector and Annotations width some object at the first render #1

Closed mikyweb closed 6 years ago

mikyweb commented 6 years ago

Hello, and compliments !, the component is very helpful.

There is a bug. If you use the PointSelector and pass to the component an array of annotations already from the first render, the component presents a bug.

> PointSelector.js?9742:14 Uncaught TypeError: Cannot read property 'width' of undefined
>     at marginToPercentage (PointSelector.js?9742:14)

I solved the problem by setting the annotations property only to the componentDidMount. I imagine the problem is timing.

Secretmapper commented 6 years ago

Fixed w/ https://github.com/Secretmapper/react-image-annotation/commit/1cbbf7134c5c43a53f2129591bc2462efc9c22f1

Thanks for the bug report!