Sie sind nicht angemeldet.

codiant

Anfänger

  • »codiant« ist der Autor dieses Themas

Beiträge: 17

Wohnort: India

Beruf: Web Developer

  • Nachricht senden

1

Freitag, 7. Juli 2017, 16:24

Check Wheather xml is in Vr mode or not

Hello,


How can i get that my xml is in vr mode or not as i want to do some extra different functionality when my xml is in vr mode, how can i do this??

Thank You

2

Freitag, 7. Juli 2017, 22:58

Hi,

the WebVR plugin offers 'onentervr' and 'onexitvr' events:
https://krpano.com/plugins/webvr/#onentervr
https://krpano.com/plugins/webvr/#onexitvr

They will be called when entering or leaving VR mode. You could use them to dynamically modify anything.

For getting the current state there is the 'isenabled' setting:
https://krpano.com/plugins/webvr/#isenabled

Maybe have also a look into the webvr.xml for more information and usage examples.

Best regards,
Klaus

Scott Witte

Fortgeschrittener

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

3

Freitag, 14. Juli 2017, 08:48

Hi Klaus,

I have a special case that is perplexing me, an attribute in a style element that should be set (reset?) depending on the webvr state. I thought I could use calc but maybe not??

Quellcode

1
<style name="detail_hs" scale="calc:(webvr.isenabled ? 0.25 : 0.5)" />

I've tried with and without parentheses. The alternative value (0.5) is selected even when in VR mode. That may be because when the XML is loaded we aren't in VR mode?

My workaround (it feels inelegant) is to test each hotspot for a defining attribute (eg: style="detail_hs") and dynamically change scale when entering or exiting VR Mode. Is that best practice?

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

4

Freitag, 14. Juli 2017, 14:33

this seems wrong to me

calc:(webvr

Not sure if that is the case though

Tuur *thumbsup*

Scott Witte

Fortgeschrittener

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

5

Samstag, 15. Juli 2017, 04:01

Hi Tuur,

I believe you were suggesting removing the colon. Doing so breaks the evaluation, and I notice in the docs that it is required.

Rereading the docs about the <style> element I realize that my suspicion is correct. The evaluation takes place as the XML is loaded and will not change after. So, the "workaround" of testing each hotspot for a condition and changing the attribute seems to be the best and only practice.

6

Samstag, 15. Juli 2017, 23:21

Hi,

the 'calc:' will be resolved only once at xml-parsing time - and at this time there is no webvr.isenabled variable defined and so that expression is always false.

For dynamic changes the onentervr/onexitvr events and dynamic code would need to be used.

Best regards,
Klaus