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

Sunday, May 26th 2019, 11:27pm

Hotspot inside a Layer

Hello there.

I am trying to add a hotspot into a layer. So far no success.

I'm using the next script to add my hotspots:


var h = krpano.get("view.hlookat");
var v = krpano.get("view.vlookat");
var hs_name = "hs" + ((Date.now() + Math.random()) | 0); // create unique/randome name
krpano.call("addhotspot(" + hs_name + ")");
krpano.set("hotspot["+hs_name+"].url", "hotspot.png");
krpano.set("hotspot["+hs_name+"].scale", 1);
krpano.set("hotspot["+hs_name+"].ath", h);
krpano.set("hotspot["+hs_name+"].atv", v);
krpano.set("hotspot["+hs_name+"].ondown", "draghotspot();");
krpano.set("hotspot["+hs_name+"].distorted", false);

This script is a Javascript inside an xml file. But it seems to add the hotspot into a higher level layer.

I already tried using:

<hotspot name="spot1" url="hotspot.png" scale="1" ath="0" atv="0" keep="true" parent="Hotspots_layer" ondown="draghotspot();" />


But it only works if I use keep="true"(otherwise hotspots is not visible) and also it doesn't respect the layer where hotspot is inside.

Thanks for the help.

Regards.

Jovan.

2

Monday, May 27th 2019, 8:30am

hotspots can't be children of layers.
(they do not have/use a parent attribute)

https://krpano.com/docu/xml/#hotspot

but why would you do that anyway?

3

Monday, May 27th 2019, 9:50am

Hello there.

Thanks for the early reply.

My purpose of trying to put hotspots inside layer is because that way it would be simple to hide and show with a button without reloading everything.
Knowing that it is not possible I would like to explore a different way.
I know there is a way to remove them all but how about just hiding them and being able to show them again with same button, that would be great. I want to perform it this way because I have multiple hotspots stored in a DB so I load them through php and if nothing else works, I'd have to load run php file Everytime I want to show them again and that is not good for scene performance.

Thanks again for the help.

Regards.

Jovan.