Elius94 / react-photo-sphere-viewer

Photosphere Viewer for React.JS
MIT License
65 stars 21 forks source link

[Bug]: getCurrentNode() not working #45

Open pasta022 opened 9 months ago

pasta022 commented 9 months ago

What happened?

on the photo-sphere-viewer docs, under the virtualTour plugin, there's a method called getCurrentNode which is supposed to return the current node. I used this in react-photo-sphere-viewer after getting an instance of the virtualTour plugin and got an error. I have attached an Image containing the error Screenshot 2023-12-29 at 03 07 01

What should have happened?

return current node

Code

// create an instance of the plugins const handleReady = (instance) => { // marker plugin intance const markersPluginInstance = instance.getPlugin(MarkersPlugin);

// virtualTour plugin instance
const virtualTourPluginInstance = instance.getPlugin(VirtualTourPlugin);

virtualTourPluginInstance.setNodes(vtplg)
const recNode = virtualTourPluginInstance.getCurrentNode()
console.log(recNode);

if (markerPlug) {
  markerPlug.addEventListener("select-marker", () => {
    console.log("marker clicked");
  });
}

};

Sandbox Link

No response

Library Version

"^3.4.0-psv5.4.0"

What operating system are you using?

macOS

What browser are you using?

Chrome

Logs

No response

Interest to fix the bug

Elius94 commented 9 months ago

Hello! thanks I'll try to figure it out. I will let you know :)

pasta022 commented 9 months ago

thank you. i have already used the "node-changed" event listener to get my nodeId which is what i was after but it'll still be great to have the method fixed