polygonal hotspot and javascript

Special forum to share and discuss skins for Pano2VR and Object2VR
Post Reply
benoit@kreaction.com
Posts: 2
Joined: Tue Nov 03, 2020 4:34 pm

Tue Nov 03, 2020 5:01 pm

Hi, i’ve got an issue with polygonal hotspot and javascript.

My project is an achitectural view of a sliced building where i make polygonal hotspot on apartments.

I use this.hotspotProxyClick=function(id) in the skin.js and put code to get and show some external information in sql database, it work well.

But i need extra informations of differents polygonals hotspots like vertices coordinates, i could have them in the xml but i don’t understand the way it is formated
for example in the xml i’ve got :

Code: Select all

    	<polyhotspot title="" target="" url="" id="0-001-T3" reuse="0">
      		<polygon row="0" vertices="0.483854,0.398148;0.540625,0.462963;0.558333,0.439815;0.552604,0.434259;0.555729,0.430556;0.563021,0.438889;0.564583,0.437037;0.572396,0.426852;0.602604,0.387037;0.61875,0.362037;0.557813,0.308333;0.545313,0.325926" column="0" state="1" />
    	</polyhotspot>
but in the .o2vr i’ve got :

Code: Select all

      <hotspot>
        <type>poly</type>
        <id>0-001-T3</id>
        <reusecolumn>0</reusecolumn>
        <reuserow>0</reuserow>
        <reusestate>0</reusestate>
        <polyitem>
          <column>0</column>
          <row>0</row>
          <state>1</state>
          <polygons>(929,430)(1038,500)(1072,475)(1061,469)(1067,465)(1081,474)(1084,472)(1099,461)(1157,418)(1188,391)(1071,333)(1047,352)</polygons>
        </polyitem>
      </hotspot>
 
coordinates are not formated in the same way, which is the good one ? I think it’s in the .o2vr but i can’t use it in javascript ?
So i wonder if i can use javascript to know attibute of polygonals hotspots and how to do that ?

If i try :

Code: Select all

this.hotspotProxyOver=function(id) {
	console.log(id)
}
i've got : "0-001-T3" which is the id of the hotspot so it works.

When i try with jQuery :

Code: Select all

this.hotspotProxyOver=function(id) {
	console.log($(id))
}

i’ve got : Object { length: 0, prevObject: {…} } but there’s nothing inside, i don’t know if there’s attribute on this object and how to get them.


Otherwise i’ve got different apartments with different informations like number of rooms and i want to show different kind of color by the number of rooms for example blue for 3 rooms apartment and red for 4 rooms apartments.
I wonder if it’s possible to change the backgroundcolor and the backgroundalpha «on the fly» in

Code: Select all

<polystyle mode="2" backgroundalpha="0.500" backgroundcolor="0xffffff" bordercolor="0x000000" borderalpha="1.000"/>';
i think this is a css style or anything else but i don’t know how to reach it.

Thanks for your help.
christoph
Gnome
Posts: 102
Joined: Mon Aug 20, 2012 3:01 pm

Thu Nov 05, 2020 12:43 pm

Hi!
The polygon color is not used anywhere in css, but inside the player, where the polygons are drawn.
So sorry, right now there is no way of manipulating colors of polygon hotspots dynamically....

Regards,
Christoph
benoit@kreaction.com
Posts: 2
Joined: Tue Nov 03, 2020 4:34 pm

Thu Nov 05, 2020 2:10 pm

Ok, thanks

and for the coordinate of polyhotspot ?
Post Reply