You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

21

Friday, September 25th 2009, 9:04pm

Hi viewinz,

Quoted

This 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 *tongue* ), I have modified the code to take into account full 360 around...
Here is an example to test the code:

Source code

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
63
64
65
66
67
<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>


The modified test_hotspot_in_range action become like this:

Source code

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>

The added code are in line 4, 5, 8 and 9 .

I think there is no error...

Let me know. *smile*

Salut.

viewinz

Intermediate

Posts: 145

Location: Wellington, New Zealand

Occupation: Trying to build an entire walkthrough of NZ for tourists

  • Send private message

22

Saturday, September 26th 2009, 7:14am

Works perfectly you are a star! *thumbsup*

23

Saturday, October 10th 2009, 9:50pm

to Klaus

Hello we would like to make a system using this, but we want to use it not with all hotspots, only selected hotspots. How can we do this? And this code we use if you have so much poly hotspots it waits soo much time to work

<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 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>
[/code]


viewinz

Intermediate

Posts: 145

Location: Wellington, New Zealand

Occupation: Trying to build an entire walkthrough of NZ for tourists

  • Send private message

24

Sunday, October 11th 2009, 7:51am

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?

Tuur

Sage

Posts: 3,120

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

25

Sunday, November 8th 2009, 1:57pm

Hi,

i have a few quesions...

I like only to have this behaviour on this hotspot... and i get an stack overload flash debug error..

Please Help *cry*

Source code

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
<hotspot name="kopman_button"         
keep="false"         visible="true" enabled="false" handcursor="true" capture="true" children="true"          
url="../P/buttons/kopman_1.png" 
scale="0.35549938091891264"   
zoom="true" 
zorder="0" 
ath="0.9449165844618079" atv="27.91916741118999">
</hotspot>



<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.1, set(hotspot[%1].alpha,0.0) );
</action>


Can anybody help me with this?

Thanx
Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

26

Sunday, November 8th 2009, 6:47pm

Hi,

in this case change the onviewchange event and call only the "test_hotspot_in_range" action with the name of the hotspot,

e.g.

Source code

1
<events onviewchange="test_hotspot_in_range(kopman_button);" />


best regards,
Klaus

27

Monday, March 22nd 2010, 6:19pm

HI,

But for 3 hotspots? *wacko*
<events onviewchange="test_hotspot_in_range(hotspot1, hotspot2, hotspot3);" /> ???

Could you help me Please
Thanks

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

28

Monday, March 22nd 2010, 9:20pm

Hi,

Try this:

Source code

1
2
3
<events onviewchange="	test_hotspot_in_range(hotspot1);
	 	 	test_hotspot_in_range(hotspot2);
	 	 	test_hotspot_in_range(hotspot3);" />


SAlut.

bulp

Intermediate

Posts: 389

Location: Malaysia

  • Send private message

29

Wednesday, March 24th 2010, 2:52pm

this code works really great.. just how to set hotspot appear/visible only when onviewchange to the center of screen?..mean to set current code EDGE = CENTER or any location.... the current hotspot been set EDGE = LEFTTOP.. i dont know how to tweak it.. :)

30

Wednesday, May 4th 2011, 9:18am

Hi there...

and sorry for bringing up such an old thread.

I´ve tried michels suggestion but it did´nt work. This is how I got it to work:

Source code

1
2
3
4
5
<events onviewchange="test_hotspot_in_range(hotspot1);
test_hotspot_in_range(hotspot2);
test_hotspot_in_range(hotspot3);
test_hotspot_in_range(hotspot4);
" />


BUT if I add all hotspots from a tour this way, than all hotspots are continously tested, even if they´re not in the active scene. And we´re talking here about 50 Hotspots! So here is my question:
How do I add only the hotspots from the active scene to the onviewchange-event? Is there a way to call an event directly inside a scene without making it globally active?

Thanks,
NUPSI

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

31

Wednesday, May 4th 2011, 3:01pm

Is there a way to call an event directly inside a scene without making it globally active?


yes you can use all the evetns in each individual scene. they will over write the global ones if they do not match. just set the hotspots you want in the viewchange event. even if you list all the hotspots they most likey are not all being tested. they are being looked for but since hotspots are usually scene specific thus keep="false" they are not actually manipulated since they are not there. only the hotspots in teh scene will be found and adjusted. still better to just adjust for the ones you know are in the scene.

32

Saturday, May 7th 2011, 12:04pm

Thanks a lot for your help, VN2011

The problem here would be that if I load 10 Hotspots in Scene 1 into the onviewchange-event, they would still be in memory in Scene 2 and krpano would still look for them, because there is no way to tell events to been deleted after leaving a scene, or is there a way?

I did a test and the performance got worse and worse each time a scene were loaded, which kinda proofs that all hotspots still in the onviewchange-event and also tested :(

Sincerly,
Nupsi

33

Monday, November 6th 2017, 2:04pm

Sorry, for digging out this old threat ... I've tested the fade in/out action and it's working good so far ...

But what if I just want specific hotspots to have that fade in/out effects? What have to be altered to only effect "my" tagged hotspots?

Source code

1
<hotspot .... tag="mytag" ... />


Would be great if someone could help me out on this. Thanks

Umalo

Professional

Posts: 1,047

Location: Osijek, Croatia, EU

  • Send private message

34

Tuesday, November 7th 2017, 12:43pm

Source code

1
2
3
4
5
6
7
8
9
10
11
12
<action name="loop_hotspots">
if (hotspot[%1].tag=='toggle_me',
 test_hotspot_in_range(get(hotspot[%1].name));
);
    inc(i);
    if (i LT hotspot.count, loop_hotspots( get(i) ) );
</action>

<hotspot name="hs_1".... tag="toggle_me" ->
<hotspot name="hs_2".... ->
<hotspot name="hs_3".... ->
<hotspot name="hs_4".... tag="toggle_me" ->

35

Tuesday, November 7th 2017, 1:59pm

Thanks a lot Umalo

Similar threads