|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<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);
sub(vdistance, view.vlookat, hotspot[%1].atv);
mod(vdistance,vdistance,360);
if(hdistance LT 0, mul(hdistance,hdistance,-1));
if(vdistance LT 0, mul(vdistance,vdistance,-1));
if(hdistance GT 60, set(hdistance,60) );
if(vdistance GT 60, set(vdistance,60) );
div(hdistance,hdistance,60);
div(vdistance,vdistance,60);
add(distance2,hdistance,vdistance);
sub(hotspot[%1].alpha,1.0,distance2);
if(hotspot[%1].alpha LT 0.5, set(hotspot[%1].alpha,0) );
</action>
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<action name="addface"> addhotspot(%1); set(hotspot[%1].url, %2); set(hotspot[%1].ath, %3); set(hotspot[%1].atv, %4); set(hotspot[%1].width, 1000); set(hotspot[%1].height, 1000); set(hotspot[%1].distorted, true); set(hotspot[%1].enabled, false); set(hotspot[%1].visible, false); set(hotspot[%1].alpha, 0.0); set(hotspot[%1].details, 16); set(hotspot[%1].zorder, %1); </action> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<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> |
So, I think the idea to put an additional variable to the hotspots that has to be afected by the test_hotspot_in_range action is the way.... but, about the if statement, I think it would be on the loop_hotspots action instead of the test_hotspot_in_range action...you could maybe give the hotspots an additional variable, i.e. type and use an if statement in test_hotspot_in_range action to test for presence of this variable, and only carry out the action if that variable is there?
|
|
Quellcode |
1 2 3 4 |
<hotspot name="HS_1" affected="true" ..... /> |
|
|
Quellcode |
1 2 3 4 5 6 |
<action name="loop_hotspots"> if (hotspot[%1].affected == true , test_hotspot_in_range(get(hotspot[%1].name))); <!--test_hotspot_in_range(get(hotspot[%1].name));--> inc(i); if (i LT hotspot.count, loop_hotspots( get(i) ) ); </action> |