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

How to use this with react #7

Closed
vabatta opened this issue Feb 4, 2020 · 7 comments
Closed

How to use this with react #7

vabatta opened this issue Feb 4, 2020 · 7 comments

Comments

@vabatta
Copy link

vabatta commented Feb 4, 2020

Hi,

how can I use this with react?

@andomain
Copy link

andomain commented Feb 5, 2020

Hi

I have used this in a React project previously. I don't have access to the code any more as it remains with my former company but I might be able to help.
What are you trying to do? In my experience the best way is to create a React wrapper around the necessary component that stores the state (in this case probably the focused coordinates) and passes any necessary handlers that update this state to the image-focus components.

@vabatta
Copy link
Author

vabatta commented Feb 5, 2020

Okay, the issue that I am facing is that I cannot 'unmount' the focused image. Once I wrapped my ref with the FocusedImage, I want to be able to return back to the state where my img element is just an img element (no inline styles, no event attached, ...). (img.stopListening is not enough)

@third774
Copy link
Owner

third774 commented Feb 5, 2020

Gotcha! Sounds like we need to add a .dispose() method?

@vabatta
Copy link
Author

vabatta commented Feb 7, 2020

Sounds good. I really want to be able to attach and detach the library to an element dynamically.

@mcabs3
Copy link

mcabs3 commented Mar 2, 2021

@third774 any update on this? I'd love this feature as well

@mcabs3
Copy link

mcabs3 commented Mar 9, 2021

I have addressed this with an initial draft (that I have working) in this PR.

@vabatta vabatta closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2024
@third774
Copy link
Owner

FWIW at this point I'd just recommend using object-position.

https://kevinkipp.com/blog/til-object-position/

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

4 participants