Sie sind nicht angemeldet.

mauma

Anfänger

  • »mauma« ist der Autor dieses Themas

Beiträge: 24

Wohnort: Lucca - Italy

Beruf: Photographer / Virtual Tour

  • Nachricht senden

1

Sonntag, 4. November 2018, 16:07

Get Hotspot onClick by code

Hi, I would know if I can intercept the onClick actions of Hotspost by this code

Quellcode

1
2
3
4
5
6
7
8
9
10
11
<events name="checkhotspots" keep="true" onviewchange="checkhotspots();" /><action name="checkhotspots">
  for(set(i,0), i LT hotspot.count, inc(i),
    copy(hs,hotspot[get(i)]);
    hs.getcenter(hs_h, hs_v);
    getlooktodistance(d, hs_h, hs_v);
    if(d LT 20,
       set(hs.hovering, true);
     ,
       set(hs.hovering, false);
      );
   ); </action>


Thanks
Mau

2

Montag, 5. November 2018, 12:40

Hi,

depends on what you want to do...

Setting the onclick event of each hotspots in that code would be e.g. possible this way:

Quellcode

1
set(hs.onclick, ...);


Best regards,
Klaus

mauma

Anfänger

  • »mauma« ist der Autor dieses Themas

Beiträge: 24

Wohnort: Lucca - Italy

Beruf: Photographer / Virtual Tour

  • Nachricht senden

3

Montag, 5. November 2018, 14:12

Hi Klaus thanks,
with onclick I would like to call his onclick action for loadscene

I try with this

Quellcode

1
callwith(hs,onclick(););


but it does not call the scene related to the intercepted hotspot

Mau

4

Dienstag, 6. November 2018, 22:58

Sorry, but I don't understand what you're trying to do...?

mauma

Anfänger

  • »mauma« ist der Autor dieses Themas

Beiträge: 24

Wohnort: Lucca - Italy

Beruf: Photographer / Virtual Tour

  • Nachricht senden

5

Mittwoch, 14. November 2018, 08:33

Hi Klaus, I wish that when a hotspot is in the middle of the stage, activate its onclick action.

Similar to webVR mode

thanks
Mau

6

Dienstag, 20. November 2018, 11:55

I also needed this, to be able to toggle the onclick event from code.
You can achieve this based on the documentation:

callwith(hs,onclick); - Note: you have to remove the ();


If you want to have the effect from external javascript:
krpano.call("callwith(hotspot["+hs+"], onclick);");

mauma

Anfänger

  • »mauma« ist der Autor dieses Themas

Beiträge: 24

Wohnort: Lucca - Italy

Beruf: Photographer / Virtual Tour

  • Nachricht senden

7

Dienstag, 20. November 2018, 13:12

hi, thanks but you code don't help me, not open the scene linked in hotspot. Same my code. :(

Kabkee

Schüler

Beiträge: 116

Wohnort: South Korea

Beruf: South Korea

  • Nachricht senden

8

Donnerstag, 7. März 2019, 10:02

Thank you. It's what I've been looking for :)
callwith(hs,onclick); - Note: you have to remove the ();

mauma

Anfänger

  • »mauma« ist der Autor dieses Themas

Beiträge: 24

Wohnort: Lucca - Italy

Beruf: Photographer / Virtual Tour

  • Nachricht senden

9

Donnerstag, 7. März 2019, 13:42

Finally I managed, but you can enter a time before the click occurs, to allow the user moving not to enter a new pano?

my code

Quellcode

1
2
3
4
5
6
7
8
9
 <action name="checkhotspots">
for(set(asz,0), asz LT hotspot.count, inc(asz), copy(hs, hotspot[get(asz)]); 
hs.getcenter(hs_h, hs_v); 
getlooktodistance(d, hs_h, hs_v); 
if(d LT 2, set(hs.hovering, true);
<!--code for delay --> 
callwith(hs,onclick); , set(hs.hovering, false);
); ); 
</action>


Thx Mau

Kabkee

Schüler

Beiträge: 116

Wohnort: South Korea

Beruf: South Korea

  • Nachricht senden

10

Donnerstag, 7. März 2019, 15:56

Finally I managed, but you can enter a time before the click occurs, to allow the user moving not to enter a new pano?

my code

Quellcode

1
2
3
4
5
6
7
for(set(asz,0), asz LT hotspot.count, inc(asz), copy(hs, hotspot[get(asz)]); 
hs.getcenter(hs_h, hs_v); 
getlooktodistance(d, hs_h, hs_v); 
if(d LT 2, set(hs.hovering, true);
 
callwith(hs,onclick); , set(hs.hovering, false);
); );


Thx Mau
Still doesn't make sense on what you want to do.

1. to enter a new pano, use loadscene() - pre-defined action.
2. 'code for delay', use delayedcall() - pre-defined action. if you set a id of the dealyedcall, you may stop the call.

mauma

Anfänger

  • »mauma« ist der Autor dieses Themas

Beiträge: 24

Wohnort: Lucca - Italy

Beruf: Photographer / Virtual Tour

  • Nachricht senden

11

Donnerstag, 7. März 2019, 16:08

Still doesn't make sense on what you want to do.

Why does not it make sense?

I would like the hotspot connected to open after a period of time when the hotspot itself is in the middle of the screen.

As it is now the script as soon as the function responds positively calls the onclick action, ie it goes to the linked scene.

What I would like to do is the same functionality that exists in the webVR mode

I tried with Delayedcall but it not works.

Thanks Mau