You are not logged in.


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" + (( + Math.random()) | 0); // create unique/randome name"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.




Monday, May 27th 2019, 8:30am

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

but why would you do that anyway?


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.