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.

mauma

Beginner

  • "mauma" started this thread

Posts: 19

Location: Lucca - Italy

Occupation: Photographer / Virtual Tour

  • Send private message

1

Sunday, November 4th 2018, 4:07pm

Get Hotspot onClick by code

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

Source code

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

Monday, November 5th 2018, 12:40pm

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:

Source code

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


Best regards,
Klaus

mauma

Beginner

  • "mauma" started this thread

Posts: 19

Location: Lucca - Italy

Occupation: Photographer / Virtual Tour

  • Send private message

3

Monday, November 5th 2018, 2:12pm

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

I try with this

Source code

1
callwith(hs,onclick(););


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

Mau

4

Tuesday, November 6th 2018, 10:58pm

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

mauma

Beginner

  • "mauma" started this thread

Posts: 19

Location: Lucca - Italy

Occupation: Photographer / Virtual Tour

  • Send private message

5

Wednesday, November 14th 2018, 8:33am

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

Tuesday, November 20th 2018, 11:55am

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

Beginner

  • "mauma" started this thread

Posts: 19

Location: Lucca - Italy

Occupation: Photographer / Virtual Tour

  • Send private message

7

Tuesday, November 20th 2018, 1:12pm

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

Kabkee

Trainee

Posts: 86

Location: South Korea

Occupation: South Korea

  • Send private message

8

Thursday, March 7th 2019, 10:02am

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

mauma

Beginner

  • "mauma" started this thread

Posts: 19

Location: Lucca - Italy

Occupation: Photographer / Virtual Tour

  • Send private message

9

Thursday, March 7th 2019, 1:42pm

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

Source code

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

Trainee

Posts: 86

Location: South Korea

Occupation: South Korea

  • Send private message

10

Thursday, March 7th 2019, 3:56pm

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

Source code

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

Beginner

  • "mauma" started this thread

Posts: 19

Location: Lucca - Italy

Occupation: Photographer / Virtual Tour

  • Send private message

11

Thursday, March 7th 2019, 4:08pm

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