Hi viewinz,
QuoteThis works really well clockwise, and fades out smoothly as it's supposed to.. However counter-clockwise it disappears abruptly.
Nothing wrong on your code.... The problem comes from the test_hotspot_in_range action that is not right when a full 360 or -360 around are done...
After some tests (scraping a lot my head ), I have modified the code to take into account full 360 around...
Here is an example to test the code:
Code
<krpano version="1.0.7">
<!-- use the editor for moving,rotating,scaling hotspots -->
<plugin name="editor" url="%SWFPATH%/plugins/editor.swf" />
<plugin name="options" url="%SWFPATH%/plugins/options.swf" />
<view fisheyefovlink="1.5" />
<preview type="grid(cube,32,32,256,0x000000,0x778899,0x000000);" details="8" />
<events onviewchange="show_hotspots_in_range()" />
<action name="show_hotspots_in_range">
set(i,0);
loop_hotspots(0);
</action>
<action name="loop_hotspots">
test_hotspot_in_range(get(hotspot[%1].name));
inc(i);
if (i LT hotspot.count, loop_hotspots( get(i) ) );
</action>
<action name="test_hotspot_in_range">
sub(hdistance, view.hlookat, hotspot[%1].ath);
mod(hdistance,hdistance,360);
if(hdistance GT 180, sub(hdistance,hdistance,360));
if(hdistance LT -180, add(hdistance,hdistance,360));
sub(vdistance, view.vlookat, hotspot[%1].atv);
mod(vdistance,vdistance,360);
if(vdistance GT 180, sub(vdistance,vdistance,360));
if(vdistance LT -180, add(vdistance,vdistance,360));
if(hdistance LT 0, mul(hdistance,hdistance,-1));
if(vdistance LT 0, mul(vdistance,vdistance,-1));
if(hdistance GT 25, set(hdistance,25) );
if(vdistance GT 25, set(vdistance,25) );
div(hdistance,hdistance,25);
div(vdistance,vdistance,25);
add(distance2,hdistance,vdistance);
sub(hotspot[%1].alpha,1.0,distance2);
if(hotspot[%1].alpha LT 0.2, set(hotspot[%1].alpha,0.2) );
</action>
<hotspot name="hs1"
keep="false"
visible="true" enabled="true" handcursor="true" capture="true" children="true"
zorder="0"
fillcolor ="0xffffff" fillalpha ="0.40" borderwidth ="2.0" bordercolor ="0xffffff" borderalpha ="0.50"
fillcolorhover="0xffffff" fillalphahover="0.40" borderwidthhover="4.0" bordercolorhover="0xffffff" borderalphahover="0.80"
fadeintime="0.150" fadeouttime="0.300" fadeincurve="1.100" fadeoutcurve="0.700"
onover=""
onhover="set(hotspot[hs1].alpha,1)"
onout="action(show_hotspots_in_range);"
ondown=""
onup=""
onclick=""
flying="0"
ath="0"
atv="0"
>
<point ath="-10" atv="-10" />
<point ath="-10" atv="10" />
<point ath="10" atv=" 10" />
<point ath="10" atv="-10" />
</hotspot>
</krpano>
Display More
The modified test_hotspot_in_range action become like this:
Code
<action name="test_hotspot_in_range">
sub(hdistance, view.hlookat, hotspot[%1].ath);
mod(hdistance,hdistance,360);
if(hdistance GT 180, sub(hdistance,hdistance,360));
if(hdistance LT -180, add(hdistance,hdistance,360));
sub(vdistance, view.vlookat, hotspot[%1].atv);
mod(vdistance,vdistance,360);
if(vdistance GT 180, sub(vdistance,vdistance,360));
if(vdistance LT -180, add(vdistance,vdistance,360));
if(hdistance LT 0, mul(hdistance,hdistance,-1));
if(vdistance LT 0, mul(vdistance,vdistance,-1));
if(hdistance GT 25, set(hdistance,25) );
if(vdistance GT 25, set(vdistance,25) );
div(hdistance,hdistance,25);
div(vdistance,vdistance,25);
add(distance2,hdistance,vdistance);
sub(hotspot[%1].alpha,1.0,distance2);
if(hotspot[%1].alpha LT 0.2, set(hotspot[%1].alpha,0.2) );
</action>
Display More
The added code are in line 4, 5, 8 and 9 .
I think there is no error...
Let me know.
Salut.