|
|
Source code |
1 2 3 4 5 6 7 8 9 10 |
<!-- radar --> <layer name="radar" keep="true" url.flash="%SWFPATH%/plugins/radar.swf" url.html5="%SWFPATH%/plugins/radar.js" align="center" zorder="1" scale.mobile="1.5" fillalpha="0.5" fillcolor="0x7F5F3F" linewidth="1.0" linecolor="0xE0E0A0" linealpha="0.5" editmode="true" /> |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 |
<action name="create-radar"> set(layer[radar].align,"topleft"); set(layer[radar].mask,"mapmask"); set(layer[radar].edge,"center"); set(layer[radar].parent,"map"); set(layer[radar].keep,"false"); set(layer[radar].scale,"2"); set(layer[radar].fillcolor,"0xFF0000"); set(layer[radar].linewidth,"1.0"); set(layer[radar].zorder, "2"); set(layer[radar].editmode, "true"); </action> |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<action name="create-radar"> addlayer(radar); set(layer[radar].align,"topleft"); set(layer[radar].mask,"mapmask"); set(layer[radar].edge,"center"); set(layer[radar].parent,"map"); set(layer[radar].keep,"false"); set(layer[radar].url.flash,"%SWFPATH%/plugins/radar.swf"); set(layer[radar].url.html5,"%SWFPATH%/plugins/radar.js"); set(layer[radar].scale,"2"); set(layer[radar].fillcolor,"0xFF0000"); set(layer[radar].linewidth,"1.0"); set(layer[radar].zorder, "2"); set(layer[radar].editmode, "true"); </action> |
This post has been edited 1 times, last edit by "robertl" (Jul 5th 2017, 4:13pm)
|
|
Source code |
1 |
if(device.html5, set(layer[radar].url. '%SWFPATH%/plugins/radar.js'); , set(layer[radar].url. '%SWFPATH%/plugins/radar.swf')); |
hi) It won't work this way. You're trying to use static xml device check while adding the layer dynamically.
Try 'if' condition instead. Like this:
![]()
Source code
1 if(device.html5, set(layer[radar].url. '%SWFPATH%/plugins/radar.js'); , set(layer[radar].url. '%SWFPATH%/plugins/radar.swf'));
|
|
Source code |
1 2 |
<hotspot name="pano15" videourl="%FIRSTXML%/spots/pano_high.mp4" devices="desktop" /> <hotspot name="pano15" videourl="%FIRSTXML%/spots/pano_low.mp4" devices="tablet.or.mobile.and.no-iphone" /> |
|
|
Source code |
1 2 3 4 5 |
addlayer(pano15); set(layer[pano15].videourl, get(%FIRSTXML%/spots/pano_high.mp4)); set(layer[pano15].devices, 'desktop'); set(layer[pano15].videourl, get(%FIRSTXML%/spots/pano_low.mp4)); set(layer[pano15].devices, 'tablet.or.mobile.and.no-iphone'); |
|
|
Source code |
1 2 3 4 5 6 7 8 9 |
addlayer(pano15);
if(device.desktop,
set(layer[pano15].videourl, get(%FIRSTXML%/spots/pano_high.mp4));
set(layer[pano15].devices, 'desktop');
);
if(device.tablet.or.mobile.and.no-iphone,
set(layer[pano15].videourl, get(%FIRSTXML%/spots/pano_low.mp4));
set(layer[pano15].devices, 'tablet.or.mobile.and.no-iphone');
);
|
Yes, can be said. They decide if that attribute will get parsed or not.So all the additional concatenated attributes are basically shorthand if checks?
but this one could:
addlayer(pano15);
if(device.desktop,
set(layer[pano15].videourl, get(%FIRSTXML%/spots/pano_high.mp4));
set(layer[pano15].devices, 'desktop');
);
if(device.tablet.or.mobile.and.no-iphone,
set(layer[pano15].videourl, get(%FIRSTXML%/spots/pano_low.mp4));
set(layer[pano15].devices, 'tablet.or.mobile.and.no-iphone');
);
|
|
Source code |
1 |
calc(layer[pano15].videourl, device.desktop ? '%FIRSTXML%/spots/pano_high.mp4' : '%FIRSTXML%/spots/pano_low.mp4'); |
|
|
Source code |
1 |
calc(layer[pano15].videourl, '%FIRSTXML%/spots/' + (device.desktop ? pano_high.mp4' : 'pano_low.mp4')); |
Hi,
- the 'if' is okay
- the 'get(...)' is wrong as the values you're setting are not variables
- and setting the 'devices' attributes is unnecessary and wouldn't do anything. krpano checks the 'devices' attributes in the xml files only during parsing the xml data to the internal data structures.
Quoted
Here an alternative one-line solution using the calc() action and the ternary (if ? then : else) operator:
or here with separating the folder-path from the file-names:
![]()
Source code
1 calc(layer[pano15].videourl, device.desktop ? '%FIRSTXML%/spots/pano_high.mp4' : '%FIRSTXML%/spots/pano_low.mp4');
![]()
Source code
1 calc(layer[pano15].videourl, '%FIRSTXML%/spots/' + (device.desktop ? pano_high.mp4' : 'pano_low.mp4'));