mistic100 / Photo-Sphere-Viewer

A JavaScript library to display 360° sphere panoramas.
https://photo-sphere-viewer.js.org
MIT License
1.93k stars 684 forks source link

Ability to force refetch of existing virtual tour node #1450

Closed AnonymousSausage77 closed 1 month ago

AnonymousSausage77 commented 1 month ago

Describe the feature

I need a way to force PSV to re-fetch a node when using Virtual Tour. Currently, I have changed the data of a virtual tour node and want to refetch it without changing which node is currently being looked at, but neither:

tour.setCurrentNode(nodeId) nor tour.init(); nor viewer.needsUpdate(); trigger a refetch of the existing node.

For example, let's say i have changed the direction of the virtual tour links (arrows) of currently-viewed virtual tour node, or perhaps I have changed the offset of the pano image, if I want to force a refetch to update the current node's configuration I don't believe there is a way to do this without deleting and re-initialising the entire viewer (let me know if there is!).

Maybe something like:

      tour.setCurrentNode(nodeId, {
        forceUpdate: true, // refetches the node regardless of if nodeId has changed or not
      })

would be cool.

Alternatives you've considered

Until this point, I was recreating the entire viewer; I was calling destroy on PSV and then recreating it with the updated settings to trigger a refetch of all settings. This had its own issues, including a webgl context overflow and is just inefficient.

Additional context

I need this because the pano viewer is acting as a frontend to give users the ability to preview their changes in real time.

I am using:

github-actions[bot] commented 2 weeks ago

This feature/bug fix has been released in version 5.11.0.

mistic100 commented 1 week ago

@AnonymousSausage77 please check https://github.com/mistic100/Photo-Sphere-Viewer/issues/1460#issuecomment-2424903963 this might be a better solution