Sie sind nicht angemeldet.

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

1

Dienstag, 8. Dezember 2015, 05:31

How do you set device checked attributes dynamically?

Say you have an object and you want to dynamically change an attribute tied to certain devices. For example:

<layer name="button" x="100" x.mobile="200" x.tablet="150" />

This works:

set(layer[button].x, 50);

but this fails:

set(layer[button].x.mobile, 50);


Obviously you can have a single x value, then run a function that resets it depending on the current device, but is there a way to do it more like I was trying?

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

2

Dienstag, 8. Dezember 2015, 11:36

hi,

try:
if(device.mobile, set(layer[button].x, 50));

etc

hope it helps
Tuur *thumbsup*

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

3

Dienstag, 8. Dezember 2015, 20:36

try:
if(device.mobile, set(layer[button].x, 50));


Right. That is the option I mentioned at the end of my post above. Still wondering if something like my first approach is possible. As it could be useful.

4

Dienstag, 15. Dezember 2015, 15:03

Hi,

here the related documentation:
http://krpano.com/docu/xml/#devicechecksforattributes

These 'device checks for attributes' are static filters that will checked during the xml attribute parsing/resolving. When the check fails the attribute will be skipped and not set.

For the dynamic device checks at runtime use expressions and if() or calc() like actions:
http://krpano.com/docu/actions/#expressions

Best regards,
Klaus

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

5

Dienstag, 15. Dezember 2015, 17:26

Thanks for the clarification.