You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, September 28th 2018, 6:58am

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.

2

Friday, September 28th 2018, 10:47am

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:

Source code

1
2
3
4
5
6
7
8
9
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