Small update on the text below:
It is not that the hotspots are not removed during scene change. They got recreated, since the hotspots of the previous scene were still around in a renamed form during the 3d transition.
Just check the explanation by Klaus further down.
-------------------------------------------------------------------------------------------------------
Hi
My plugin dev skills have been progressing nicely over the past few days, but now I am stuck and confused again.
I've built a simple plugin which replaces the standard arrows (those with skin_hotspotstyle) that are displayed in the tours, with my own arrows that rotate/move with the view direction, like the navigation arrows in google street view.
This is working quite nicely, but for some reason I dont understand, my arrows dont always get removed when the scene changes.
They get removed when the scene is changed with the normal navigation elements of the virtual tour (forward/back arrows or clicking a thumbnail). When the scene change is triggered by clicking my own navigation arrows, the arrwos are still visible in the next scene together with the arrows of that next scene. Since the "normal" scene change is executed through skin_loadscene and the scene change which is triggered through the navigation arrows is executed through skin_scene3dtransition I assume it must be due to some difference between the two methods (but I still dont find a solution).
My code to generate the navigation arrow hotspots (they consist of the actual hotspot and a second hotspot below to simulate the shadow) and to hide the org hotspot looks as follows (positioning of the hotspots in space depending on the current view direction takes place in another function):
for(let i=krpano.hotspot.count-1;i>0;i--) {
const orghs=krpano.hotspot.getItem(i);
if(orghs.style=="skin_hotspotstyle") {
const orghsname=orghs.name;
const arrowhsname="navarrow_"+orghsname;
const shadowhsname="navarrow_shadow_"+orghsname;
const arrowhs = krpano.addhotspot(arrowhsname);
arrowhs.loadstyle("navarrowstyle_arrow");
arrowhs.setvars({
keep:false,
heading: orghs.ath,
yoffset:0,
onclick:"callwith(hotspot["+orghsname+"],onclick)"
});
const shadowhs= krpano.addhotspot(shadowhsname);
shadowhs.loadstyle("navarrowstyle_shadow");
shadowhs.setvars({
keep:false,
heading: orghs.ath,
yoffset: 4
});
orghs.setvars({visible:false});
};
};
Display More
The heading and yoffset attributes are used internaly for the positioning of the hotspots in space (using tx, ty, tz) when the view rotates. I guess the keep attribute could be removed - I have only added it hoping it would solve my problem. The above piece of code gets executed on the onnewpano event.
The style for the hotspots is defined as follows:
<style name="navarrowstyle_base" type="image" distorted="true" zoom="false" depth="0" scale="0.03" rotationorder="xyz" rx="-90" ry="90" rz="0"/>
<style name="navarrowstyle_shadow" style="navarrowstyle_base" url="navarrow_shadow.png" zorder="1000" />
<style name="navarrowstyle_arrow" style="navarrowstyle_base" url="navarrow_white.png" zorder="1001" />
Any hints would be greatly appreciated!