Sie sind nicht angemeldet.

1

Donnerstag, 29. Juni 2023, 23:03

Toggle hotspots on/off

Basic question. I have a set of hotspots that turn on, but does not turn off using one button. Any thoughts on making this work?

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<layer name="off_button7" keep="true" align="TopRight" x="20" y="185" url="vtourskin_hotspot6.png" scale="0.5" devicescale="true" alpha="0.8" zorder="92" rotate="0" onover="set(alpha, 1);" onout="set(alpha, 0.8);" onclick="toggleHotSpotsNiveau1();" />

<action name="toggleHotSpotsNiveau1">
  if visible == false) (
    set(hotspot[spot7].visible, true);
    set(hotspot[spot8].visible, true);
    set(hotspot[spot9].visible, true);
    set(hotspot[spot10].visible, true);
    set(hotspot[spot11].visible, true);
    set(hotspot[spot12].visible, true);
    set(hotspot[spot13].visible, true);
    set(hotspot[spot14].visible, true);
    set(hotspot[spot15].visible, true);
    set(hotspot[spot16].visible, true);
    set(hotspot[spot17].visible, true);
    set(hotspot[spot18].visible, true);
    set(hotspot[spot19].visible, true);
    set(hotspot[spot20].visible, true);
  ) else (
    set(hotspot[spot7].visible, false);
    set(hotspot[spot8].visible, false);
    set(hotspot[spot9].visible, false);
    set(hotspot[spot10].visible, false);
    set(hotspot[spot11].visible, false);
    set(hotspot[spot12].visible, false);
    set(hotspot[spot13].visible, false);
    set(hotspot[spot14].visible, false);
    set(hotspot[spot15].visible, false);
    set(hotspot[spot16].visible, false);
    set(hotspot[spot17].visible, false);
    set(hotspot[spot18].visible, false);
    set(hotspot[spot19].visible, false);
    set(hotspot[spot20].visible, false);
  )
</action>


		<hotspot name="spot7" url="skin/vtourskin_hotspot_14.png" edge="bottom"  onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3" visible="false" ath="115.274" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot8" url="skin/vtourskin_hotspot_15.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3" visible="false" ath="-133.175" atv="8.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot9" url="skin/vtourskin_hotspot_13.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="96.019" atv="3.000" tag="niveau1" linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot10" url="skin/vtourskin_hotspot_12.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="87.144" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot11" url="skin/vtourskin_hotspot_11.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="58.490" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot12" url="skin/vtourskin_hotspot_10.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="72.916" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot13" url="skin/vtourskin_hotspot_9.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="65.497" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot14" url="skin/vtourskin_hotspot_8.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"   visible="false" ath="50.040" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot15" url="skin/vtourskin_hotspot_7.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="42.776" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot16"  url="skin/vtourskin_hotspot_6.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="35.672" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot17" url="skin/vtourskin_hotspot_5.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="27.759" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot18" url="skin/vtourskin_hotspot_4.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="6.901" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot19" url="skin/vtourskin_hotspot_3.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="-30.536" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot20" url="skin/vtourskin_hotspot_2.png" edge="bottom" onover.addevent="tween(scale,0.8);" onout.addevent="tween(scale,0.3);" scale="0.3"  visible="false" ath="-37.474" atv="3.000" tag="niveau1"  linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot21" url="vtourskin_hotspot_2.png" edge="bottom"  onover.addevent="tween(scale,0.9);" onout.addevent="tween(scale,0.3);" scale="0.3" visible="false" ath="-42.755" atv="1.000" tag="niveau2" linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot22" url="vtourskin_hotspot_3.png" edge="bottom"  onover.addevent="tween(scale,0.9);" onout.addevent="tween(scale,0.3);" scale="0.3" visible="false" ath="-33.928" atv="1.000" tag="niveau2" linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot23" url="vtourskin_hotspot_4.png" edge="bottom"  onover.addevent="tween(scale,0.9);" onout.addevent="tween(scale,0.3);" scale="0.3" visible="false" ath="-26.649" atv="1.000" tag="niveau2" linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot24" url="vtourskin_hotspot_5.png" edge="bottom"  onover.addevent="tween(scale,0.9);" onout.addevent="tween(scale,0.3);" scale="0.3" visible="false" ath="-75.700" atv="1.000" tag="niveau2" linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot25" url="vtourskin_hotspot_6.png" edge="bottom"  onover.addevent="tween(scale,0.9);" onout.addevent="tween(scale,0.3);" scale="0.3" visible="false" ath="-55.700" atv="1.000" tag="niveau2" linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot26" url="vtourskin_hotspot_7.png" edge="bottom"  onover.addevent="tween(scale,0.9);" onout.addevent="tween(scale,0.3);" scale="0.3" visible="false" ath="-95.700" atv="1.000" tag="niveau2" linkedscene="" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot6" style="skin_hotspotstyle3" ath="13.305" atv="27.682" linkedscene="scene_exterior_vr_7" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot27" style="skin_hotspotstyle3" ath="5.399" atv="19.512" linkedscene="scene_exterior_vr_2" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot28" style="skin_hotspotstyle3" ath="17.989" atv="19.328" linkedscene="scene_exterior_vr_6" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot29"  style="skin_hotspotstyle3" ath="26.990" atv="13.516" linkedscene="scene_exterior_vr_9" linkedscene_hoffset="0.0" use3dtransition="true" />
		<hotspot name="spot30"  style="skin_hotspotstyle3" ath="22.729" atv="6.010" linkedscene="scene_exterior_vr_8b" linkedscene_hoffset="0.0" use3dtransition="true" />

2

Freitag, 30. Juni 2023, 01:33

"visible" is not defined. So it is interpreted as "false" and hence the hotspots are set to be visible. You may just add a variable to have the state of the visibilty and check if the variable is true or false in the if.

3

Freitag, 30. Juni 2023, 09:42

Correct^^
And you might also take a look at the for-loop *smile*

Quellcode

1
2
3
4
5
6
7
8
9
10
set(hs_visible,true); (this var can be changed at any point and should be set befor calling the action!!!)

set(hotspot_count,20);
for(set(i,0), i LT hotspot_count, inc(i), 
txtadd(hs_name,'spot',get(i));
if(hs_visible == true,
set(hotspot[get(hs_name)].visible,true);
,
set(hotspot[get(hs_name)].visible,false);
);

Beiträge: 141

Wohnort: Russia, Komi republic, Uhta

Beruf: developer

  • Nachricht senden

4

Freitag, 30. Juni 2023, 12:58

https://krpano.com/docu/xml/#layer.autoalpha - Look also at this parameter. If it is True, then if visible = false - alpha also automatically becomes 0

Hello from uhta3d )))
I'm in telegram: Lastromantik

5

Freitag, 30. Juni 2023, 13:29

"visible" is not defined. So it is interpreted as "false" and hence the hotspots are set to be visible. You may just add a variable to have the state of the visibilty and check if the variable is true or false in the if.


Sounds good. Will trying defining, and add variable and report back on progress.

6

Freitag, 30. Juni 2023, 13:31

Correct^^
And you might also take a look at the for-loop *smile*

Quellcode

1
2
3
4
5
6
7
8
9
10
set(hs_visible,true); (this var can be changed at any point and should be set befor calling the action!!!)

set(hotspot_count,20);
for(set(i,0), i LT hotspot_count, inc(i), 
txtadd(hs_name,'spot',get(i));
if(hs_visible == true,
set(hotspot[get(hs_name)].visible,true);
,
set(hotspot[get(hs_name)].visible,false);
);

Correct^^
And you might also take a look at the for-loop *smile*

Quellcode

1
2
3
4
5
6
7
8
9
10
set(hs_visible,true); (this var can be changed at any point and should be set befor calling the action!!!)

set(hotspot_count,20);
for(set(i,0), i LT hotspot_count, inc(i), 
txtadd(hs_name,'spot',get(i));
if(hs_visible == true,
set(hotspot[get(hs_name)].visible,true);
,
set(hotspot[get(hs_name)].visible,false);
);

Correct^^
And you might also take a look at the for-loop *smile*

Quellcode

1
2
3
4
5
6
7
8
9
10
set(hs_visible,true); (this var can be changed at any point and should be set befor calling the action!!!)

set(hotspot_count,20);
for(set(i,0), i LT hotspot_count, inc(i), 
txtadd(hs_name,'spot',get(i));
if(hs_visible == true,
set(hotspot[get(hs_name)].visible,true);
,
set(hotspot[get(hs_name)].visible,false);
);


Reading up on the loop method. Thanks for forwarding, going to try this as an option.

7

Freitag, 30. Juni 2023, 13:33

https://krpano.com/docu/xml/#layer.autoalpha - Look also at this parameter. If it is True, then if visible = false - alpha also automatically becomes 0


Will give this method a shot. I'm familiar with autoalpha, so think I can set something up. Thanks for suggesting this.