Sie sind nicht angemeldet.

1

Samstag, 29. September 2018, 11:29

How to make a distorted hotspot with a hide button

how to make a distorted and draggable hotspot with a hide button (not distorted)



Thanks
Suso
»Suso Barral« hat folgendes Bild angehängt:
  • hide.jpg

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Suso Barral« (29. September 2018, 12:34)


2

Samstag, 29. September 2018, 22:19

what I want to achieve is that when I drag the hotspot the layer follows the hotspot at the same distance



https://dearte.online/test1/




<hotspot name="spot1" url="1.jpg" ath="0" atv="-0.3016131110635691" scale="0.3" rx="0" ry="49.649999999999935" rz="0" distorted="true" keep="true" ondown="draghotspot()" />


<layer name="button" type="container" align="center" x="140" y="-170" width="30" height="30" bgcolor="0x44AADD" bgalpha="1.0" bgcapture="true" ondown="draglayer()" >

</layer>




<action name="draghotspot">
spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery, calc(mouse.stagex LT stagewidth/2 ? 'l' : 'r')); sub(drag_adjustx, mouse.stagex, hotspotcenterx); sub(drag_adjusty, mouse.stagey, hotspotcentery); asyncloop(pressed, sub(dx, mouse.stagex, drag_adjustx); sub(dy, mouse.stagey, drag_adjusty); screentosphere(dx, dy, ath, atv);
<!-- print_hotspot_pos(); -->
set(layer[val_ath].html, calc:'ATH = ' + hotspot[get(name)].ath); set(layer[val_atv].html, calc:'ATV = ' + hotspot[get(name)].atv); );
</action>

<action name="draglayer">
copy(drag_currentx, x);
copy(drag_currenty, y);
copy(drag_stagex, mouse.stagex);
copy(drag_stagey, mouse.stagey);
indexoftxt(align_contains_right, get(align), 'right');
indexoftxt(align_contains_bottom, get(align), 'bottom');
calc(drag_align_x, align_contains_right GE 0 ? -1 : +1);
calc(drag_align_y, align_contains_bottom GE 0 ? -1 : +1);
asyncloop(pressed,
calc(x, drag_currentx + (mouse.stagex - drag_stagex)*drag_align_x);
calc(y, drag_currenty + (mouse.stagey - drag_stagey)*drag_align_y);
);
</action>


the blue layer would be the hotspot hide button

Thanks
Suso

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Suso Barral« (29. September 2018, 23:02)


3

Sonntag, 30. September 2018, 06:13

Try it
layer "button" - edge="center"
hotspot "spot1" - edge="righttop"

Add to
action "draghotspot"

asyncloop(pressed,
...
spheretoscreen(ath, atv, h_x, h_y);
set(layer[button].x,get(h_x));
set(layer[button].y,get(h_y));
);




And why not just do it parent="hotspot[spot1]" ? *confused*

Dieser Beitrag wurde bereits 12 mal editiert, zuletzt von »San7« (30. September 2018, 09:11)


4

Sonntag, 30. September 2018, 09:46

If you need to permanently bind



<events onviewchanged="spheretoscreen(hotspot[spot1].ath, hotspot[spot1].atv, h_x, h_y);
set(layer[button].x,get(h_x));
set(layer[button].y,get(h_y));
"
/>

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »San7« (30. September 2018, 10:51)


5

Sonntag, 30. September 2018, 10:17

Hi San

Thank you very much, I'll try it ;-) ;-)


Suso

6

Sonntag, 30. September 2018, 11:09



if I have edited the code correctly these are the results:





layer "button" - edge="center"
hotspot "spot1" - edge="righttop"


https://dearte.online/test2/

https://dearte.online/test2/krpano.xml


it could work but when I click on the hotspot the layer goes to the right corner below





--------------------------------------------


this option distorts the layer


parent="hotspot[spot1]"




https://dearte.online/test3

https://dearte.online/test3/krpano.xml



*unsure*

7

Sonntag, 30. September 2018, 11:16

layer align="lefttop"

hotspot "spot1" - edge="righttop"

8

Sonntag, 30. September 2018, 11:29

If you want to put the button on the upper right corner, then layer align="righttop"

9

Sonntag, 30. September 2018, 11:35

works!!



Best greetings
*thumbsup* *thumbsup* *thumbsup*

10

Sonntag, 30. September 2018, 11:50

one last question,
when I turn the panorama the hotspot moves but it is not followed by the layer,


has it this solution? *confused*



thanks


11

Sonntag, 30. September 2018, 14:03

Remove everything you have done.
Another solution:

<events onviewchanged="spheretoscreen(hotspot[spot1].ath, hotspot[spot1].atv, h_x, h_y);
set(layer[button].x,get(h_x));
set(layer[button].y,get(h_y));
"
/>