mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.

Home Page:https://pannellum.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

removeHotSpot is not working

aliMurtaja opened this issue · comments

here's my code, removeHotSpot should have worked but it didn't

var newHotspot = {
        pitch: pitch,
        yaw: yaw,
        cssClass: "custom-hotspot",
        createTooltipFunc: hotspot,
        createTooltipArgs: "New Hotspot",
        isAddInfoEnable: true
    };

    // Add the new hotspot to the viewer
    // viewer.addHotSpot(newHotspot);
    

    setTimeout(() => {
    viewer.removeHotSpot(newHotspot);
    }, 3000);
    viewer.addHotSpot(newHotspot);

the hotspot added, but after 3sec it should have removed but it didn't

That's because you're using the removeHotSpot function incorrectly. As is stated in the API documentation, the removeHotSpot function takes a hotSpotId string as its argument, but you're passing it an object. You need to include an id attribute in your newHotspot object and set it to a string; you can then call removeHotSpot with that string as the argument to remove the hot spot.

Ohh, Thank you, now it's working.

I had been searching solution since yesterday.
I am using this library in my React project, I think you should have made a different library for React.
yes there is a library called react-pannellum but that is not giving the support from long-time

I think you should have made a different library for React.

You're entitled to your opinion, but I have no interest whatsoever in React (or Angular or Vue, or whatever other bloated client-side library is popular these days).