You are not logged in.

San7

Professional

  • "San7" started this thread

Posts: 594

Occupation: coding in krpano

  • Send private message

1

Monday, November 16th 2020, 4:34pm

hide/show hotspot groups

Hi! I want to share a code example of how to show/hide groups of hotspots.
example http://novosibpano.ru/VT/groupHS/

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<action name="hide_show" scope="local" args="gr" >
   for(set(i,0), i LT hotspot.count, inc(i),
         copy(hs, global.hotspot[get(i)]);
         txtreplace(dstvar, gr, get(hs.group),);
         if(hs.group,
             if(dstvar !== gr,
                     set(hs.enabled, true);
                     set(hs.visible, true);
                     ,
                     set(hs.enabled, false);
                     set(hs.visible, false);
                );
             );
          );
</action>

Add the attribute to hotspots: group="red"
red is the name of the group
To show the group call the action : hide_show('red');
Hide hotspots that belong to other groups, if only they have a group.
To show multiple groups, simply list them in parentheses separated by commas: hide_show('green, red');


Only for local hotspots

kangsj2277

Trainee

Posts: 75

Location: Republic of Korea

  • Send private message

2

Wednesday, November 18th 2020, 1:27am

This is very useful code. san7 *smile*

3

Sunday, June 6th 2021, 1:42pm

Would it be possible to create an action to drag a group of 2 hotsposts that are in the same position to a new position?

thanks
Best

San7

Professional

  • "San7" started this thread

Posts: 594

Occupation: coding in krpano

  • Send private message

4

Sunday, June 6th 2021, 6:27pm

I think when dragging and dropping, you will need to poll all hotspots for the presence of a group and, under this condition, transmit the coordinates of the dragged hotspot.
If you immediately register the name of the second hotspot inside the dragged hotspot, then it's easier to do

5

Sunday, June 6th 2021, 7:41pm

Thanks for your help

https://dearte.online/group/

https://dearte.online/group/project3d.xml


this is what I am trying, before I used a layer parent hotspot, but in 3d it does not work

Best

San7

Professional

  • "San7" started this thread

Posts: 594

Occupation: coding in krpano

  • Send private message

6

Sunday, June 6th 2021, 8:08pm

Try adding HSshadow = "sombra0" to the hotspot
In action name = "dragspot"

asyncloop (...
copy (hotspot [get (HSshadow)]. x, x);
copy (hotspot [get (HSshadow)]. y, y);
copy (hotspot [get (HSshadow)]. z, z);

7

Sunday, June 6th 2021, 8:12pm

Ok Thanks


I will try it

8

Sunday, June 6th 2021, 8:30pm

<hotspot name="sombra0" type="text" HSshadow = "sombra0".....



asyncloop(caller.pressed, .....



copy (hotspot [get (HSshadow)]. x, x);
copy (hotspot [get (HSshadow)]. y, y);
copy (hotspot [get (HSshadow)]. z, z);
callwith(caller, showspotinfos(); );


);
</action>

if I have put it correctly, it does not work

San7

Professional

  • "San7" started this thread

Posts: 594

Occupation: coding in krpano

  • Send private message

9

Sunday, June 6th 2021, 8:55pm

Replace with this


asyncloop(caller.pressed, .....



copy(hotspot[get(caller.HSshadow)].tx, caller.tx);
copy(hotspot[get(caller.HSshadow)].ty, caller.ty);
copy(hotspot[get(caller.HSshadow)].tz, caller.tz);


callwith(caller, showspotinfos(); );


);
</action>

10

Sunday, June 6th 2021, 9:09pm

it does not work *wacko*

11

Sunday, June 6th 2021, 9:11pm

and with groups?

San7

Professional

  • "San7" started this thread

Posts: 594

Occupation: coding in krpano

  • Send private message

12

Monday, June 7th 2021, 4:26am

it does not work *wacko*
I checked, this is working code *smile*
example

13

Monday, June 7th 2021, 10:30am

Ok, perfect!!
Thanks
Best ;-)

14

Thursday, June 10th 2021, 1:01am

How can I activate and deactivate an action?
for example in this case "dragspot"

thank you and good night

San7

Professional

  • "San7" started this thread

Posts: 594

Occupation: coding in krpano

  • Send private message

15

Thursday, June 10th 2021, 9:27am

How can I activate and deactivate an action?
for example in this case "dragspot"

thank you and good night
Create a variable like "drag" and toggle its value (false / true).
Take action on the condition of this variable, for example:

Source code

1
2
3
4
5
<action name="dragspot"> 
     if(drag,	
        ... the code ...	
       );	
 </action>

16

Thursday, June 10th 2021, 2:40pm

Ok, thanks.
I will try it ;-)

17

Thursday, June 10th 2021, 9:04pm




now the hotspots only move along the wall and the shadow remains at the original distance.
I need to find an action to scale, and toggle each of them on and off.

Something curious is that if you do not touch the viewer for some time then the hotspots begin to flash *cry*


dearte.online/h2/

andrew22222

Intermediate

Posts: 385

Location: Australia

  • Send private message

18

Thursday, June 16th 2022, 9:58am

A bit late to this post but thanks very much *thumbsup*