hoaiduyit/react-pannellum

Use addHotspot in react component

Closed this issue · 3 comments

I would like to add hotspot by clicked on pannellum or in some div.
My code bellow:
`
class App extends Component {

initPanalleum() {

}
componentWillMount() {
  ReactPannellum.lookAt(20,10);
}

click() {
  let panel = getContainer();
    addHotSpot({
        "pitch": 14.1,
        "yaw": 1.5,
        "type": "info",
        "text": "Baltimore Museum of Art",
        "URL": "https://artbma.org/"
    }, "firstScene");
    console.log(getConfig());
}

render() {
  const config = {
      autoLoad: true
  }
return (
    <div>
        <ReactPannellum
            sceneId="firstScene"
            config={config}
            imageSource="https://pannellum.org/images/alma.jpg"
        />
        <div onClick={this.click}>Click me</div>
    </div>
);

}
}
`

But here I get Error TypeError: Cannot read property 'hotspot' of undefined. How can I get reference for pannelium?

@vakhsakhalyan , I'm sorry for the lately reply, I will check it again and tell what the problem is.

hi @vakhsakhalyan , I updated newest version that fixed your problem, please update the package and check again. Thank you.