Sie sind nicht angemeldet.

1

Freitag, 13. November 2020, 15:53

Text inside a polygonal hotspot

hello, could someone help me?


I would like to insert a text, inside a polygon and take the name of the hotspot as text.


Like this example:


https://krpano.com/releases/1.20.9/viewer/krpano.html?xml=examples/cylinder-grid-hotspots/cylinder-grid-hotspots.xml


This is my current customization of the hotspots:


Quellcode

1
 <style name="HOUZES"  fillcolor="0xff0000"  fillalpha="0.6"  capture="false" changespot="true" borderwidth="0"  bordercolor="0xaaaaaa"  borderalpha="0.6"  onover="tween(fillalpha,0.8);"  onout="tween(fillalpha,0.6);"  onclick=""  ondown.touch="onover(); asyncloop(pressed, onhover(); );"  onup.touch="onout();" /> 



An important information, the hotspot must be fixed to the flat pano.


To get the hotspot name would be something like that?


hotspot[get(hs_name)]


I count a lot with some help.


Thank you!

2

Freitag, 13. November 2020, 17:42

Hi,

here an example - first add this code anywhere in the xml:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<style name="poly_hotspot_text" onloaded.addevent="add_poly_hotspot_text();" />

<action name="add_poly_hotspot_text" scope="local">
    addhotspot(auto,hs);
    set(hs, 
        type=text,
        bg=false,
        enabled=false,
        css='font-size:14px;color:#FFFFFF;',
        html=get(caller.name)
    );
    caller.getcenter(hs.ath, hs.atv);
</action>


And then add:

Quellcode

1
style="poly_hotspot_text"
to the related <hotspot> elements.

Best regards,
Klaus

3

Freitag, 13. November 2020, 18:17

Extraordinary.

Thanks a lot for the help.


But could I ask for a little more help?



The text is zooming. Would it be possible to define a size and keep it fixed? In the same way that the polygon works?

Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von »msbojr« (13. November 2020, 20:09)


Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

5

Montag, 16. November 2020, 17:35

You already helped me a lot, but if you allow me, I would like to ask for more help

It is not working on IOS (iPad and iPhone).

In this link I put your code:

https://houzes.com.br/360/Litoral_RS/_pl…test_floorplan/





Would it be possible to use the same format as this code for an example of krpano?


https://krpano.com/releases/1.20.9/examp…r-grid-hotspots



Thank you!

6

Montag, 16. November 2020, 18:25

Add zoom=true this way:

Quellcode

1
2
3
4
5
6
7
8
set(hs, 
        type=text,
        bg=false,
        enabled=false,
        zoom=true,
        css='font-size:14px;color:#FFFFFF;',
        html=get(caller.name)
    );


or maybe better distorted=true instead:

Quellcode

1
2
3
4
5
6
7
8
set(hs, 
        type=text,
        bg=false,
        enabled=false,
        distorted=true,
        css='font-size:14px;color:#FFFFFF;',
        html=get(caller.name)
    );

7

Dienstag, 17. November 2020, 14:09



I would like to know if you could help me with a problem I am having, with IOS compatibility, of two items:

Hotspots - are different in IOS (bigger, when clicked).
Polygon text - An error occurs in IOS and does not even load the page. And I also need the text to have a fixed size, when zooming, do not change the defined size.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »msbojr« (18. November 2020, 21:32)


8

Dienstag, 17. November 2020, 18:57

The number of hotspots seems to be too much for iOS...

Add also renderer='css3d' to render the hotspots via HTML, that saves texture memory:

Quellcode

1
2
3
4
5
6
7
8
9
set(hs, 
        type=text,
        bg=false,
        enabled=false,
        distorted=true,
        renderer='css3d',
        css='font-size:14px;color:#FFFFFF;',
        html=get(caller.name)
    );

9

Mittwoch, 18. November 2020, 15:27

It's amazing how much you help this community.

Thanks a lot for the help.

Everything worked.

10

Dienstag, 6. September 2022, 18:27

Would it be possible to include a function that doesn't show the text if the polygon is visible="false"?