farminf / pannellum-react

React Component for Pannellum (open source panorama viewer for the web)
MIT License
112 stars 81 forks source link

Display context menu on Pannellum #123

Open ghost opened 1 year ago

ghost commented 1 year ago

I am trying to create an app where teachers will be able to set mathematical questions in hotspots, if the students give a correct answer than they are allowed to access the content from the hotspot.

But in order to do that I need to somehow get the current position (yaw and pitch) the teacher clicks in the screen and then display a context menu, with an option to add a question, I've thought of this by setting on the Pannellum component a false prop in draggable, but by doing so I am unable to click on the screen whatsoever.

I would control the position accordingly to this example page

<Pannellum
    width="100%"
    height="100%"
    image={currentScene}
    yaw={300}
    pitch={0}
    hfov={110}
    draggable={false}
    autoLoad
    compass
    showZoomCtrl={false}
    mouseZoom={false}
    onMousedown={() => {
      // custom action to display a context menu
    }}>
    <Pannellum.Hotspot
        type="custom"
        pitch={-30}
        yaw={-120}
        handleClick={() => console.log('clicked')} />
</Pannellum>