How to create a hotspot(custom sprite) in the plugin interface?

  • How to create a hotspot(custom sprite) in the plugin interface?


    This do not work :(
    var hs = krpano.addhotspot(name);
    hs.ath = 0;
    hs.atv = 0;
    hs.sprite = document.createElement('div');
    hs.sprite.appendChild(element);

    Do you have any relevant example?

    I want to load the plugin only once and create multiple hotspots.

  • Hi,

    directly adding custom html elements is not possible,
    it would be necessary to load an image as hotspot image first,
    you could use a 1x1 transparent pixel for this case if you want.
    Additionally the renderer setting need to get set to css3d to display the hotspot as html element and having a 'sprite' element.

    Here an example:

    Code
    var hs = krpano.addhotspot(name);
    hs.renderer = "css3d";
    hs.url = "transparent_1x1_pixel.png"
    hs.onloaded = function()
    {
      var element = document.createElement('div');
      hs.sprite.appendChild(element);
      ...
    }

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!