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

Remove references to window and document #110

Open
bveldkamp opened this issue Nov 28, 2024 · 0 comments
Open

Remove references to window and document #110

bveldkamp opened this issue Nov 28, 2024 · 0 comments

Comments

@bveldkamp
Copy link

I am trying to integrate react-pannellum in a 3rd party application, and while this works in general, I found a niche problem.

This 3rd party application provides a function to detach ('pop-out') certain elements from its UI, and open those in a separate browser window. This is very convenient, because a user can now have Pannellum in a window side-to-side with the rest of the application.

The problem is that some of your code relies on the current document, and the current window. In my case, these are the document and window from which the pop-out was initiated, and not the new window. This results in pannellum trying to render to the wrong document.

I think I managed to hack this on my end, so if you take PR's?

Otherwise, these are the necessary changes:

  • In the render() method add a ref value to the returned div, e.g. ref: "myself",
  • In _this.init(): Reference that ref, rather than container: myPannellum = pannellum.viewer(_this.refs.myself, {
  • In onImageLoad() where the event listeners are set up, replace document with container.ownerDocument, and windows with container.ownerDocument.defaultView

Maybe more work is needed, but at least this seems to have fixed it for me.

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

1 participant