react-pdf-highlighter icon indicating copy to clipboard operation
react-pdf-highlighter copied to clipboard

Area Highlight is misaligned on container resize

Open ausaf-a opened this issue 1 year ago • 2 comments

When an area highlight is placed after window resize, the highlights are not aligned with the mouse pointer. Seems to be off by a scale factor.

https://github.com/agentcooper/react-pdf-highlighter/assets/23505065/0080dbc8-efca-4fd0-97a2-279ce77323a7

ausaf-a avatar Dec 07 '23 03:12 ausaf-a

I've proposed a fix for this just now. You can wait for it to get merged or implement it yourself for the time being. You could also use my fork, but its structure and syntax is quite different to this repo and will probably be more effort to adapt to your application.

DanielArnould avatar Dec 07 '23 22:12 DanielArnould

If you are facing the issue while zooming in or zooming out then you can divide your rect with scale value. Screenshot from 2024-07-04 14-20-10

Make sure you have to save scale for different selection. Screenshot from 2024-07-04 14-22-13

And pass this as prop to your highlighter component Screenshot from 2024-07-04 14-23-31

dheerajkp77 avatar Jul 04 '24 08:07 dheerajkp77