You are not logged in.

1

Tuesday, July 11th 2017, 8:33am

How to set custom style value in VR mode?

Hi,

I have my hotspot defined as

<hotspot name="pin_d42a6e3b_3" title="" ath="150.08399" atv="45.324" linkedscene="" onclick="hotspotClicked()" preload="true" style="infospot1" edge="topleft" />


and the style infospot1 defined as

<style name="infospot1" url="%$basepath%/img/info.png" distorted="false" scale="0.2" />


I want to set a custom scale factor of 0.6 in the style above in VR mode (when following condition is true)

(device.mobile AND webvr.isenabled)



How do I set scale value conditionally in my krpano XML?
Thanks

spacerywirtualne

Professional

Posts: 1,117

Location: Poland, Europe

Occupation: krpano developer : virtual tours : the cms4vr owner

  • Send private message

2

Tuesday, July 11th 2017, 3:24pm

Hi

Maybe try a this small piece of code:

Add a tag var to you style:

<style name="infospot1" url="%$basepath%/img/info.png" distorted="false" scale="0.2" tag="vr_manipulate" />

and:

Source code

1
2
3
  <plugin name="WebVR"         
	onentervr="...;change_scale()"        
	onexitvr="...;change_scale()"        />      



Source code

1
2
3
4
5
6
7
8
9
10
11
  <action name="change_scale">    
for(set(i,0),i LT hotspot.count,inc(i),      
	if(hotspot[get(i)].tag == 'vr_manipulate',        
		if(device.mobile AND webvr.isenabled,          
			set(hotspot[get(i)].scale, 0.6);        
		,          
			set(hotspot[get(i)].scale, 0.2);        
		);      
	)   
); 
</action>


Best regards
Piotr
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*