Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Area Highlight is misaligned on container resize #259

Open
ausaf-a opened this issue Dec 7, 2023 · 2 comments
Open

Area Highlight is misaligned on container resize #259

ausaf-a opened this issue Dec 7, 2023 · 2 comments

Comments

@ausaf-a
Copy link

ausaf-a commented Dec 7, 2023

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.

Screen.Recording.2023-12-06.at.10.49.37.PM.mov
DanielArnould added a commit to DanielArnould/react-pdf-highlighter-extended that referenced this issue Dec 7, 2023
Update the containerBoundingRect on every mouseDown event. This ensures the container coords are correct on page resize and hopefully fixes issue agentcooper#259 .

This does add some extra overhead, but less than re-rendering the whole element on a page resize.
@DanielArnould
Copy link
Contributor

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.

@dheerajkp77
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants