agentcooper / react-pdf-highlighter

Set of React components for PDF annotation
https://agentcooper.github.io/react-pdf-highlighter
MIT License
973 stars 388 forks source link

fix bug in pdfCoordinates. #244

Closed varung closed 11 months ago

varung commented 11 months ago

The existing code has a bug since it sets the top of the rectangle to y1. This implies y1 < y2. However, the height is calculated as y1 - y2 (which would be negative).

There is a one character fix (i.e., set height = y2 - y1), but, the provided patch is more robust to misunderstandings by the user about what order the coordinates are provided in.

agentcooper commented 11 months ago

Thanks!