This commit is contained in:
2025-03-05 09:26:04 +01:00
parent 5cf0717170
commit d7bba13cdf
5028 changed files with 286142 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,502 @@
<krpano>
<!--
combobox.xml Plugin - krpano 1.19-pr16
- This plugin converts <combobox> elements in the current xml
into <layer> container, scrollarea and textfield elements.
- Additionally it's also possible to add and remove combobox
elements also dynamically.
- The full xml implementation allows many ways of customizing
for own needs - custom designs/styles, custom functionality.
- The plugin works automatically the same for HTML5 and Flash.
- It's possible to use this plugin as replacement for the old
combobox.swf/combobox.js plugins, the action interfaces are
the same.
Syntax for Static XML Code:
<combobox name="..." design="..." ...any layer settings...>
<item name="..." caption="..." onclick="..." />
<item name="..." caption="..." onclick="..." />
</combobox>
Syntax for Dynamic XML Code:
- Global Actions:
addComboboxLayer(cbname, design*)
removeComboboxLayer(cbname);
- Combobox Layer Actions:
layer[cbname].addItem(caption, onclick)
layer[cbname].addNamedItem(name, caption, onclick)
layer[cbname].addIdItem(name, caption, onclick); same as addNamedItem (for combobox.js compatibility)
layer[cbname].selectItem(caption)
layer[cbname].selectItemByName(name_or_index)
layer[cbname].selectIdItem(name_or_index) same as selectItemByName (for combobox.js compatibility)
layer[cbname].removeAll()
layer[cbname].openList()
layer[cbname].closeList()
- Events/Callbacks:
layer[cbname].onChange
- Combobox Layer Attributes:
layer[cbname].item - krpano Array of the items
layer[cbname].selecteditemindex - current selected item index
-->
<!-- path to the scrollarea plugin -->
<combobox_scrollareaplugin
url.html5="%SWFPATH%/plugins/scrollarea.js"
url.flash="%SWFPATH%/plugins/scrollarea.swf"
/>
<!-- core internal layer styles -->
<style name="combobox_container_style" type="container" maskchildren="true" bgcapture="true" visible="false" onclick="combobox_onclick_event();" mergedalpha="false" alpha="1.0" />
<style name="combobox_marker_style" type="text" align="righttop" edge="center" html="▼" havemarkersize="false" onautosized="set(havemarkersize,true);" mergedalpha="false" alpha="1.0" />
<style name="combobox_item_style" type="text" wordwrap="false" vcenter="true" align="lefttop" onover="if(!combbox_item_pressed,onoveritem());asyncloop(hovering,,if(!combbox_item_pressed,onoutitem()));" ondown="onoveritem(); set(combbox_item_pressed,true);" onup="onoutitem(); set(combbox_item_pressed,false);" onoveritem="set(bg,true);" onoutitem="set(bg,false);" mergedalpha="false" alpha="1.0" />
<!-- several pre-defined designs -->
<combobox_design name="default" margin="2" open_close_speed="0.25">
<!-- default design - white box with black text and blue selection -->
<style name="combobox_container_style" bgalpha="1.0" bgcolor="0xFFFFFF" bgborder="1 0xFFFFFF 0.5" bgroundedge="1" bgshadow="0 1 3 0x000000 1.0" />
<style name="combobox_marker_style" css="color:#FFFFFF;" bg="false" txtshadow="0 0 2 0x000000 1" />
<style name="combobox_item_style" css="color:#222222;" padding="4 4" bg="false" bgcolor="0xC7E4FC" bgalpha="1.0" bgroundedge="1" txtshadow="0 0 1 0xFFFFFF 1.0" />
</combobox_design>
<combobox_design name="vtour" margin="4" open_close_speed="0.25">
<!-- default vtourskin.xml design -->
<style name="combobox_container_style" bgalpha="0.8" bgcolor="0x2D3E50" bgborder="0" bgroundedge="1" bgshadow="0 4 10 0x000000 0.3" />
<style name="combobox_marker_style" css="color:#FFFFFF;" bg="false" txtshadow="0 0 2 0x000000 1" />
<style name="combobox_item_style" css="color:#FFFFFF;" padding="4 4" bg="false" bgcolor="0xFFFFFF" bgalpha="0.5" bgroundedge="0" txtshadow="0 0 2 0x000000 1" />
</combobox_design>
<!-- internal events -->
<events name="combobox_xml_plugin_events" keep="true"
onxmlcomplete="combobox_parse_xml_elements();"
onresize="combobox_closelist();"
/>
<!-- krpano version check -->
<action name="combobox_versioncheck" autorun="preinit">
if(build LT '2017-09-13',
error('combobox.xml - too old krpano version!');
set(events[combobox_xml_plugin_events].name, null);
set(action[addComboboxLayer].content, '');
set(action[removeComboboxLayer].content, '');
);
</action>
<!-- convert all <combobox> elements to layers -->
<action name="combobox_parse_xml_elements" scope="localonly">
if(global.combobox,
copy(combobox_src, global.combobox);
delete(global.combobox);
def(i, integer, 0);
def(cnt, integer, get(combobox_src.count));
if(cnt GT 0, loop(i LT cnt,
copy(cb, combobox_src[get(i)]);
if(cb AND cb.name AND cb.parsed != true,
set(cb.parsed, true);
addComboboxLayer(get(cb.name), get(cb.design));
copy(ly, global.layer[get(cb.name)]);
copyattributes(get(ly), get(cb));
set(ly.keep, true);
def(item_cnt, integer, get(cb.item.count));
if(item_cnt GT 0,
def(item_i, integer, 0);
loop(item_i LT item_cnt,
combobox_additem(get(ly.name), get(cb.item[get(item_i)].name), get(cb.item[get(item_i)].caption), get(cb.item[get(item_i)].onclick));
inc(item_i);
);
);
);
inc(i);
));
);
</action>
<!-- dynamically add a combobox layer -->
<action name="addComboboxLayer" scope="localonly" args="cbname, design">
<!-- create the layer -->
addlayer(get(cbname));
copy(cb, global.layer[get(cbname)]);
set(cb.keep, true);
<!-- copy the design settings (or set defaults) -->
if(!global.combobox_design[get(design)].name, set(design,'default'));
copy(cb.cbdesign, global.combobox_design[get(design)]);
calc(cb.margin, cb.cbdesign.margin !== null ? cb.cbdesign.margin : 2);
calc(cb.open_close_speed, cb.cbdesign.open_close_speed !== null ? cb.cbdesign.open_close_speed : 0.25);
<!-- load the styles and copy the design style settings -->
cb.loadstyle(combobox_container_style);
copyattributes(get(cb), get(cb.cbdesign.style[combobox_container_style]));
<!-- add/build/map actions -->
calc(cb.addItem, 'combobox_additem(' + cbname + ', null, "%%1", "%%2");');
calc(cb.addNamedItem, 'combobox_additem(' + cbname + ', "%%1", "%%2", "%%3");');
calc(cb.addIdItem, 'combobox_additem(' + cbname + ', "%%1", "%%2", "%%3");');
calc(cb.selectItem, 'combobox_finditem(' + cbname + ', "%%1", __cb_fi); if(__cb_fi GE 0, combobox_selectitem(' + cbname + ', get(__cb_fi))); delete(__cb_fi);');
calc(cb.selectItemByName, 'combobox_selectitem(' + cbname + ', "%%1");');
calc(cb.selectIdItem, 'combobox_selectitem(' + cbname + ', "%%1");');
calc(cb.removeAll, 'combobox_removeitems(' + cbname + ');');
calc(cb.openList, 'combobox_openlist(' + cbname + ');');
calc(cb.closeList, 'combobox_closelist(' + cbname + ');');
<!-- create sub-layers -->
calc(saname, 'combobox_' + cbname + '_scrollarea');
addlayer(get(saname));
copy(sa, global.layer[get(saname)]);
copy(sa.parent, cbname);
copy(sa.url, global.combobox_scrollareaplugin.url);
copy(sa.keep, true);
copy(sa.align, lefttop);
set(sa.direction, v);
set(sa.enabled, false);
set(sa.width, 100%);
set(sa.height, 100%);
copy(cb.scrollarea, sa);
calc(mkname, 'combobox_' + cbname + '_marker');
addlayer(get(mkname));
copy(mk, global.layer[get(mkname)]);
copy(mk.parent, saname);
copy(mk.keep, true);
mk.loadstyle(combobox_marker_style);
copyattributes(get(mk), get(cb.cbdesign.style[combobox_marker_style]));
copy(cb.marker, mk);
<!-- item data array -->
cb.createarray('item');
<!-- item autosizing information -->
set(cb.autosize_i, 0);
set(cb.autosize_cnt, 0);
set(cb.autosize_max_w, 0);
set(cb.autosize_max_h, 0);
set(cb.lastselecteditemindex, 0);
set(cb.selecteditemindex, 0);
</action>
<!-- dynamically remove a combobox element -->
<action name="removeComboboxLayer" scope="localonly" args="cbname">
if(global.layer[get(cbname)],
copy(cb, global.layer[get(cbname)]);
if(cb === global.openedcombobox, delete(global.openedcombobox));
if(cb,
removelayer(get(cbname), true);
);
);
</action>
<!-- default onclick event for combobox elements: open the list -->
<action name="combobox_onclick_event">
combobox_openlist(get(name));
</action>
<!-- dynamically add items -->
<action name="combobox_additem" scope="localonly" args="cbname, itemname, itemcaption, itemonclick">
copy(cb, global.layer[get(cbname)]);
<!-- when no item name is set, generate an automatic one -->
if(itemname === null, calc(itemname, 'autoname_' + cb.item.count); );
<!-- save the item caption and onclick event -->
copy(cb.item[get(itemname)].caption, itemcaption);
copy(cb.item[get(itemname)].onclick, itemonclick);
inc(cb.autosize_cnt);
<!-- create the item layer/textfield -->
calc(itemlayername, 'comboboxitem_' + cbname + '_' + itemname);
addlayer(get(itemlayername));
copy(li, global.layer[get(itemlayername)]);
li.loadstyle(combobox_item_style);
copyattributes(get(li), get(cb.cbdesign.style[combobox_item_style]));
copy(li.parent, cb.scrollarea.name);
copy(li.keep, true);
copy(li.cblayername, cb.name);
copy(li.itemname, itemname);
copy(li.html, itemcaption);
set(li.onautosized, delayedcall(0,combobox_item_autosize_update()) );
set(li.onclick, combobox_item_onclick() );
copy(cb.item[get(itemname)].itemlayername, itemlayername);
</action>
<!-- onautosized callback from the item textfield -->
<action name="combobox_item_autosize_update" scope="localonly">
copy(cb, global.layer[get(caller.cblayername)]);
inc(cb.autosize_i);
Math.max(cb.autosize_max_w, caller.width);
Math.max(cb.autosize_max_h, caller.height);
if(cb.autosize_i == cb.autosize_cnt, combobox_align_items(get(cb.name)); );
</action>
<!-- align the image and set the combobox size -->
<action name="combobox_align_items" scope="localonly" args="cbname">
copy(cb, global.layer[get(cbname)]);
if(cb.marker.havemarkersize == false OR cb.scrollarea.loaded == false,
<!-- wait until everything is ready -->
delayedcall(calc(cb.name + '_waitformarkersize'), 0.01, combobox_align_items(get(cbname)) );
,
<!-- set the item positions and the combobox size -->
if(global.openedcombobox === cb, combobox_closelist() );
copy(sa, cb.scrollarea);
calc(itemwidth, cb.margin GT 0 ? -2 * cb.margin : '100%');
copy(mk_w, cb.marker.width);
copy(item_cnt, cb.autosize_cnt);
for(def(item_i, integer, 0), item_i LT item_cnt, inc(item_i),
copy(li, global.layer[get(cb.item[get(item_i)].itemlayername)]);
set(li.x, get(cb.margin));
copy(li.width, itemwidth);
copy(li.height, cb.autosize_max_h);
calc(li.y, cb.margin + item_i * (cb.autosize_max_h + cb.margin));
);
if(cb.width == null OR cb.width == cb.lastautosizedwidth,
<!-- no combobox width (or an autosized width) set - set the largest item width -->
calc(cb.width, cb.margin + cb.autosize_max_w + 2 + mk_w + cb.margin);
copy(cb.lastautosizedwidth, cb.width);
);
calc(cb.height, 2*cb.margin + cb.autosize_max_h);
calc(sa.height, cb.margin + item_cnt*(cb.margin+cb.autosize_max_h));
calc(sa.y, -(cb.selecteditemindex * (cb.autosize_max_h + cb.margin)));
calc(cb.marker.x, cb.margin + mk_w/2);
tween(global.layer[get(cb.name)].marker.y, calc(cb.margin + cb.selecteditemindex*(cb.autosize_max_h + cb.margin) + cb.autosize_max_h/2), 0.1);
<!-- when all is done, show the combobox -->
delayedcall(0.1, set(global.layer[get(cb.name)].visible,true); );
);
</action>
<!-- helper action for calling a plugin event-code with 'global' and 'caller' scope -->
<action name="combobox_do_event_call" scope="local" args="cb, eventcode">
if(eventcode !== null, callwith(cb, get(eventcode) ); );
</action>
<!-- default onclick event for items: select the current item, close the list and call the item onclick event -->
<action name="combobox_item_onclick" scope="localonly">
copy(cb, global.layer[get(caller.cblayername)]);
copy(itemname, caller.itemname);
combobox_selectitem(get(cb.name), get(itemname));
if(global.openedcombobox === cb, combobox_closelist() );
if(cb.item[get(itemname)].onclick,
if(cb.callonclickafterclose === false,
<!-- call instantly -->
combobox_do_event_call(get(cb), get(cb.item[get(itemname)].onclick));
,
<!-- call the onclick event after the combobox has closed -->
delayedcall(get(cb.open_close_speed),
copy(cb.curitem, cb.item[get(itemname)]);
combobox_do_event_call(get(cb), get(cb.item[get(itemname)].onclick));
);
);
);
</action>
<!-- select an item -->
<action name="combobox_selectitem" scope="localonly" args="cbname, itemname">
if(global.combbox_item_pressed != true,
copy(cb, global.layer[get(cbname)]);
copy(cb.lastselecteditemindex, cb.selecteditemindex);
copy(cb.selecteditemindex, cb.item[get(itemname)].index);
<!-- call onchange event on selection change -->
if(cb.lastselecteditemindex != cb.selecteditemindex AND cb.onchange,
combobox_do_event_call(get(cb), get(cb.onchange));
);
if(global.openedcombobox === cb,
<!-- when opened, just close to the selected item -->
combobox_closelist();
,
if(global.layer[get(cbname)].scrollarea.loaded,
global.layer[get(cbname)].scrollarea.stopscrolling();
calc(offset, cb.selecteditemindex*(cb.autosize_max_h + cb.margin));
tween(global.layer[get(cbname)].marker.y, calc(cb.margin + offset + cb.autosize_max_h/2), 0);
tween(global.layer[get(cbname)].scrollarea.y, calc(-offset), 0, default, global.layer[get(cbname)].scrollarea.update(); );
);
);
);
</action>
<!-- find an item by its caption, the global variable defined in 'returnvariable' will contain the index -->
<action name="combobox_finditem" scope="localonly" args="cbname, itemcaption, returnvariable">
copy(cb, global.layer[get(cbname)]);
copy(item_cnt, cb.item.count);
set(calc('global.' + returnvariable), -1);
for(def(item_i, integer, 0), item_i LT item_cnt, inc(item_i),
if(cb.item[get(item_i)].caption == itemcaption,
copy(calc('global.' + returnvariable), item_i);
copy(item_i, item_cnt);
);
);
</action>
<!-- remove all items (to be able to add new ones) -->
<action name="combobox_removeitems" scope="localonly" args="cbname">
copy(cb, global.layer[get(cbname)]);
if(global.openedcombobox === cb, combobox_closelist() );
<!-- remove all item layers -->
calc(item_i, cb.item.count - 1);
loop(item_i GE 0,
removelayer(get(cb.item[get(item_i)].itemlayername));
dec(item_i);
);
<!-- reset the item information -->
set(cb.item.count, 0);
set(cb.autosize_i,0);
set(cb.autosize_cnt, 0);
set(cb.autosize_max_w, 0);
set(cb.autosize_max_h, 0);
set(cb.selecteditemindex, 0);
set(cb.lastselecteditemindex, 0);
if(cb.width == cb.lastautosizedwidth, set(cb.width, null));
</action>
<!-- open the combobox list -->
<action name="combobox_openlist" scope="localonly" args="cbname">
<!-- if another combobox is already open, close that one first -->
if(global.openedcombobox !== null, combobox_closelist() );
copy(cb, global.layer[get(cbname)]);
copy(global.openedcombobox, cb);
<!-- find the available screen space above or below the combobox -->
calc(cbheight, 2*cb.margin + cb.autosize_max_h);
set(lx1, 0);
set(ly1, 0);
copy(lx2, cb.pixelwidth);
copy(ly2, cbheight);
layertoscreen(get(cbname), lx1,ly1, lx1,ly1);
layertoscreen(get(cbname), lx2,ly2, lx2,ly2);
calc(space_above, ly1 - global.area.pixely);
calc(space_below, global.area.pixelheight - (ly2 - global.area.pixely));
<!-- the required space for full opening: -->
calc(openheight, cb.margin + cb.autosize_cnt*(cb.margin+cb.autosize_max_h) );
<!-- vertical centered alignment? -->
calc(cb_edge, cb.edge ? cb.edge : cb.align);
calc(iscentered, cb_edge == 'left' OR cb_edge == 'center' OR cb_edge == 'right');
if(iscentered,
calc(openheight_max, space_above + space_below);
,
Math.max(openheight_max, space_above, space_below);
);
<!-- limit the height to the available space (minus some margin) -->
Math.min(openheight, calc(openheight_max + cbheight - 20));
<!-- need vertical offset? (depending on the available space and the align/edge setting) -->
set(yoffset, null);
calc(top_overflow, -ly1 + global.area.pixely + openheight/2);
calc(bottom_overflow, ly2 - global.area.pixely + openheight/2 - global.area.pixelheight);
if(cb.parent,
<!-- no vertical offset inside other layers, do only a height clipping -->
Math.max(max_overflow, top_overflow, bottom_overflow, 0);
sub(openheight, max_overflow);
,
if(iscentered,
if(openheight GE (global.area.pixelheight - 20),
set(yoffset,0);
,
if(top_overflow GT 0, calc(yoffset, cb.y + top_overflow); );
if(bottom_overflow GT 0, calc(yoffset, cb.y - bottom_overflow); );
);
,
indexoftxt(isbottomalign, get(cb_edge), 'bottom');
if(space_above GT space_below,
if(isbottomalign LT 0, calc(yoffset, cb.y - openheight + cbheight); );
,
if(isbottomalign GE 0, calc(yoffset, cb.y - openheight + cbheight); );
);
);
);
if(yoffset != null,
copy(cb.ybackup, cb.y);
tween(global.layer[get(cbname)].y, calc(yoffset), get(cb.open_close_speed));
);
<!-- center the opened list at the selected item -->
calc(centeritem_y, -1 * (cb.margin + cb.selecteditemindex*(cb.margin+cb.autosize_max_h) + cb.autosize_max_h/2 - openheight/2));
clamp(centeritem_y, calc(openheight - cb.scrollarea.height), 0);
<!-- apply the changes now -->
tween(global.layer[get(cbname)].height, get(openheight), get(cb.open_close_speed));
tween(global.layer[get(cbname)].scrollarea.y, get(centeritem_y), get(cb.open_close_speed), default, global.layer[get(cbname)].scrollarea.update(); );
<!-- special html5/flash case:
rotating textfields (the marker symbol here) are not possible in
flash (a flashplayer limitation), so use a rotated symbol instead.
-->
if(device.html5,
tween(global.layer[get(cbname)].marker.rotate, 90, get(cb.open_close_speed));
,
set(global.layer[get(cbname)].marker.html, '◀');
);
<!-- enable the scrollarea to allow the user to drag it -->
set(cb.scrollarea.enabled, true);
<!-- install a global onmousedown event to close the list when clicking at the pano -->
set(global.events[combobox_xml_plugin_events].onmousedown, combobox_closelist() );
</action>
<!-- close the current open list -->
<action name="combobox_closelist" scope="localonly">
if(global.openedcombobox !== null,
copy(cb, global.openedcombobox);
delete(global.openedcombobox);
<!-- clear the global onmousedown event -->
set(global.events[combobox_xml_plugin_events].onmousedown, null);
<!-- disable the dragging -->
set(cb.scrollarea.enabled, false);
<!-- closing animations -->
calc(offset, cb.selecteditemindex*(cb.autosize_max_h + cb.margin));
if(cb.ybackup !== null, tween(cb.y, get(cb.ybackup), get(cb.open_close_speed)));
global.layer[get(cb.name)].scrollarea.stopscrolling();
tween(global.layer[get(cb.name)].height, calc(2*cb.margin + cb.autosize_max_h), get(cb.open_close_speed));
tween(global.layer[get(cb.name)].scrollarea.y, calc(-offset), get(cb.open_close_speed), default, global.layer[get(cb.name)].scrollarea.update(); );
tween(global.layer[get(cb.name)].marker.y, calc(cb.margin + offset + cb.autosize_max_h/2), get(cb.open_close_speed));
<!-- special html5/flash case: rotate marker or change symbol -->
if(device.html5,
tween(global.layer[get(cb.name)].marker.rotate, 0, get(cb.open_close_speed));
,
set(global.layer[get(cb.name)].marker.html, '▼');
);
);
</action>
</krpano>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
/*
krpano 1.19-pr16 ScrollArea Plugin (build 2018-04-04)
http://krpano.com/plugins/scrollarea/
*/
var krpanoplugin=function(){function P(a){return"boolean"==typeof a?a:0<="yesontrue1".indexOf(String(a).toLowerCase())}function Z(a){if(a&&k&&aa){var d=k.timertick,f=0;0==Q&&(Q=d);var b=d-Q|0;Q=d;"wheel"==a.type?f=a.deltaY:"mousewheel"==a.type?f=-a.wheelDelta:"DOMMouseScroll"==a.type&&(f=a.detail);f=-f;500<b?R=1==a.deltaMode||0==f%20?0:1:66>b&&0==R&&0!=f%40&&6<Math.abs(f)&&(R=1);a.preventDefault();a.stopPropagation();0!=f&&(0==R?f=0>f?-5:5:(f/=20,-10>f?f=-10:10<f&&(f=10)),1==n?S(f*A,0):2==n?S(0,f*
y):3==n&&S(0,f*y))}}function r(a,d,f,b,e){var c=null;e=(!0===e?"remove":"add")+"EventListener";var g=T.browser.events;if(g.touch&&("down"==d?c=g.touchstart:"move"==d?c=g.touchmove:"up"==d&&(c=g.touchend),T.ie&&0==g.mouse&&("over"==d?c=g.pointerover?g.pointerover:"MSPointerOver":"out"==d&&(c=g.pointerout?g.pointerout:"MSPointerOut")),c))a[e](c,f,b);if(g.mouse&&("down"==d?c="mousedown":"move"==d?c="mousemove":"up"==d?c="mouseup":"over"==d?c="mouseover":"out"==d&&(c="mouseout"),c))a[e](c,f,b)}function ba(){if(b){var a=
b.sprite.parentNode;a&&(a=a.kobject)&&(a.maskchildren=!0,a.poschanged&&a.updatepluginpos(),b.poschanged&&b.updatepluginpos(),ca=a,t=a.pixelwidth,u=a.pixelheight,isNaN(t)&&(t=0),isNaN(u)&&(u=0),D=0<t||0<u)}}function E(){e=Number(b.x);c=Number(b.y);isNaN(da)&&(e=0);isNaN(ea)&&(c=0)}function F(a){a=void 0===a?!1:a;1==(n&1)?b.x!=e&&(b.x=e,a=!0):e=0;2==(n&2)?b.y!=c&&(b.y=c,a=!0):c=0;!D||U[0]==v&&U[1]==w||(U[0]=v,U[1]=w,a=!0);if(a&&b&&D){a=t-v;var d=u-w,f=e,l=c;isNaN(f)&&(f=0);isNaN(l)&&(l=0);f+=a*p;l+=
d*q;b.woverflow=-a;b.hoverflow=-d;b.loverflow=Math.round((-f+G*a)*A);b.roverflow=Math.round((+f-(1-G)*a)*A);b.toverflow=Math.round((-l+H*d)*y);b.boverflow=Math.round((+l-(1-H)*d)*y);b.onscroll&&k.call(b.onscroll,b)}}function ia(a){for(;0<z.length&&!(100>=a-z[0].time);)z.shift()}function I(){ba();var a=String(b.align).toLowerCase();if(""==a||"null"==a)a="lefttop";y=A=1;q=p=.5;H=G=0;0<=a.indexOf("left")&&(p=G=0,A=1);0<=a.indexOf("top")&&(q=H=0,y=1);0<=a.indexOf("right")&&(G=1,p=0,A=-1);0<=a.indexOf("bottom")&&
(H=1,q=0,y=-1)}function ja(a){I();z=[];if(0==J)x=!1;else{r(window,"up",fa,!0);r(window,"move",ga,!0);var d=k.stagescale,b=a.changedTouches&&0<a.changedTouches.length?a.changedTouches[0]:a;a=b.pageX/d;d=b.pageY/d;x=!1;V=a;W=d;return!1}}function ka(a){(void 0===a.pointerType||4==a.pointerType||"mouse"==a.pointerType)&&ha&&(I(),0!=D&&(a=u-w,0>t-v||0>a))&&(K=!0,r(b.sprite,"move",la,!0),r(b.sprite,"out",ma,!0))}function la(a){K&&0==x&&ca&&(a=ca.getmouse(),X(a.x/t*b.pixelwidth,a.y/u*b.pixelheight,!0))}
function ma(a){r(b.sprite,"move",la,!0,!0);r(b.sprite,"out",ma,!0,!0);K=!1}function ga(a){if(0==J)return x=!1;var d=k.stagescale,b=a.changedTouches&&0<a.changedTouches.length?a.changedTouches[0]:a;a=b.pageX/d;d=b.pageY/d;0==x&&(n&1&&5<Math.abs(a-V)||n&2&&5<Math.abs(d-W))&&(B&&(g=h=0,B=!1),null!=m&&(clearInterval(m),m=null),x=!0,K=!1,V=a,W=d,E(),da=e,ea=c);x&&(b=k.timertick,ia(b),z.push({time:b,x:a,y:d}),e=da+(a-V)*A,c=ea+(d-W)*y,a=-(v-t),d=-(w-u),e+=a*p,c+=d*q,b=1/(1+C*C),e=0<a?e-(e-a*p)*b:e-(0<e?
e:e<a?e-a:0)*b,c=0<d?c-(c-d*q)*b:c-(0<c?c:c<d?c-d:0)*b,e-=a*p,c-=d*q,F());return!1}function fa(a){r(window,"up",fa,!0,!0);r(window,"move",ga,!0,!0);if(0==J)g=h=0,x=!1;else if(x){ia(k.timertick);if(1<z.length){a=z[0];var d=z[z.length-1],b=d.y-a.y,c=(d.time-a.time)*Y;h=(d.x-a.x)/c*A;g=b/c*y}else g=h=0;m=setInterval(L,1E3/60);x=!1}}function pa(){setTimeout(function(){ba();F(!0);null==m&&(m=setInterval(L,1E3/60))},100)}function qa(){b&&(ba(),E(),F(!0))}function L(){e+=h;c+=g;h*=M;g*=M;var a=0,d=0,b=-(v-
t),l=-(w-u);e+=b*p;c+=l*q;0<b?a=e-b*p:B?a=e-na:e<b?a=e-b:0<e&&(a=e);.1>a*a&&(a=0);0<l?d=c-l*q:B?d=c-oa:c<l?d=c-l:0<c&&(d=c);.1>d*d&&(d=0);e-=b*p;c-=l*q;0==(n&1)&&(h=a=0);0==(n&2)&&(g=d=0);0!=a&&(a*=-1,e+=a*(1-C),h=0>=a*h?h+a*N:a*O,h*=C);0!=d&&(d*=-1,c+=d*(1-C),g=0>=d*g?g+d*N:d*O,g*=C);0==a&&0==d&&.05>Math.sqrt(h*h+g*g)&&(B=!1,g=h=0,clearInterval(m),m=null);F()}function X(a,b,f){I();E();if(0==D)setTimeout(function(){X(a,b,f)},10);else{a=Number(a);isNaN(a)&&(a=0);b=Number(b);isNaN(b)&&(b=0);var l=t-
v,g=u-w;a=G*v+a*A;b=H*w+b*y;a*=-1;b*=-1;a+=t/2;0<a&&(a=0);a<l&&(a=l);b+=u/2;0<b&&(b=0);b<g&&(b=g);!0===f?(B=!0,na=a,oa=b,null==m&&(m=setInterval(L,1E3/60))):(l=-(v-t),g=-(w-u),a=0>l?a-l*p:0,b=0>g?b-g*q:0,e=a,c=b,F())}}function ra(a,b){X(a,b,!0)}function sa(){x&&(r(window,"up",fa,!0,!0),r(window,"move",ga,!0,!0));null!=m&&(clearInterval(m),m=null);K=x=!1;z=[];g=h=0;B=!1;E()}function S(a,b){B=!1;a=Number(a);isNaN(a)&&(a=0);b=Number(b);isNaN(b)&&(b=0);I();E();if(0!=D){var f=t-v,l=u-w,k=!1;0>f&&(e+=f*
p,0<a&&0>e?(k=!0,h+=a):0>a&&e>f&&(k=!0,h+=a),e-=f*p);0>l&&(c+=l*q,0<b&&0>c?(k=!0,g+=b):0>b&&c>l&&(k=!0,g+=b),c-=l*q);k&&null==m&&(m=setInterval(L,1E3/60))}}var k=null,b=null,T=null,n=3,v=0,w=0,U=[0,0],D=!1,ca=null,t=0,u=0,B=!1,na=0,oa=0,A=1,y=1,p=0,q=0,G=0,H=0,C=1,M=.95,N=.08,O=.15,Y=1/15,J=!0,aa=!0,x=!1,V=0,W=0,e=0,c=0,da=0,ea=0,m=null,z=[],h=0,g=0,K=!1,ha=!1;this.registerplugin=function(a,c,e){k=a;b=e;"1.19">k.version?(k.trace(3,"Scrollarea Plugin - too old krpano version (min. version 1.19)"),
b=k=null):(T=k.device,b.registerattribute("direction","all",function(a){a=String(a).toLowerCase();n=0;n|=1*(0<=a.indexOf("h"));n|=2*(0<=a.indexOf("v"));n|=3*(0<=a.indexOf("all"))},function(){return 3==(n&3)?"all":1==(n&1)?"h":"v"}),b.registerattribute("overscroll",C,function(a){C=0>a?0:1<a?1:a},function(){return C}),b.registerattribute("friction",M,function(a){M=Number(a)},function(){return M}),b.registerattribute("acceleration",N,function(a){N=Number(a)},function(){return N}),b.registerattribute("returnacceleration",
O,function(a){O=Number(a)},function(){return O}),b.registerattribute("momentum",Y,function(a){Y=Number(a)},function(){return Y}),b.registerattribute("onscroll",null),b.registerattribute("woverflow",0),b.registerattribute("hoverflow",0),b.registerattribute("loverflow",0),b.registerattribute("roverflow",0),b.registerattribute("toverflow",0),b.registerattribute("boverflow",0),b.registerattribute("draggable",!0,function(a){J=P(a)},function(){return J}),b.registerattribute("mwheel",!0,function(a){aa=P(a)},
function(){return aa}),b.registerattribute("onhover_autoscrolling",!1,function(a){ha=P(a)},function(){return ha}),b.registerattribute("csshardwareacceleration","auto"),b.setcenter=X,b.scrolltocenter=ra,b.stopscrolling=sa,b.scrollby=S,b.update=qa,1==P(b.csshardwareacceleration)&&(b.sprite.style[T.browser.css.transform+"Style"]="preserve-3d"),b.sprite.addEventListener("DOMMouseScroll",Z,!0),b.sprite.addEventListener("mousewheel",Z,!0),b.sprite.addEventListener("wheel",Z,!0),r(b.sprite,"down",ja,!0),
r(b.sprite,"over",ka,!0),k.set("events["+b.name+"_scrollarea].keep",!0),k.set("events["+b.name+"_scrollarea].onresize",pa))};var Q=0,R=0;this.onresize=function(a,b){if(!k)return!1;v=a;w=b;var f;B=!1;I();E();if(0==D)f=!1;else{f=t-v;var g=u-w,h=!1;e+=f*p;if(0>f){if(0>e||e>f)h=!0}else 0!=e&&(h=!0);e-=f*p;c+=g*q;if(0>g){if(0>c||c>g)h=!0}else 0!=c&&(h=!0);c-=g*q;h&&null==m&&(m=setInterval(L,1E3/60));f=h}0==f&&F(!0);return!1};this.unloadplugin=function(){k&&b&&(k.set("events["+b.name+"_scrollarea].name",
null),null!=m&&(clearInterval(m),m=null),r(b.sprite,"down",ja,!0,!0),r(b.sprite,"over",ka,!0,!0));k=b=null}};

View File

@@ -0,0 +1,5 @@
/*
krpano 1.19-pr16 Sound Interface Plugin (build 2018-04-04)
http://krpano.com/plugins/soundinterface/
*/
"[[KENCPUZR#cF#Zd.k,1.,*bv4&$JO-cbher%H;`_;TWr=LbHV(Dj[e:>LvZE]8:ipWq(h0n`d*$%jg[J#ldGD_R+@^.HT_W/j[MFIFA3@n(XEv##9klgK2lH$[k;X_873ZY*Eaa^GODs9iF=D);0s-&oH2IOu_lleXamrlQ[eaTOYY6ZA,_UYRnO0?6-ph8nqZLCSBiT>j4aV(%IOfpF1Ib[*%e.oA*G[OEPZDWC<T8n,=GUgh$L;`G3FYLso31d<MTTlPBRABmF9Yx@:N?1KTXaR0NI@KC)H$u7VGXaw1*Hdt+t'8llau1gCm3)k'eFw,u-qUvLBDxSTbrFb#H&'/[I4Bt5OHQ2P4Yn%EK3xa?i1Ygl&kL$[vDFuVf?vr$?`:`v$lU0H](kvRt:i)(K_i=J0-Z0^0S7wUF37*tSKaj&x>5j8tS9Fx*/E<:f8S[K4Uq1+dL]-5:11;rs=o3@SX=xl]Mu<hZV&jW'`=Sresr>cPa4TuhXh=Y$C#x^qo^67L65D*EUc'@WhCbVcr?u7hq@SeRbF-b8k-s@x<TQMHlMq#UQo8S'Ylr@#L4/6LnSO^Y410)8D_@(_sL)nVt8lf4bcMG]B4N'(B>@Q0HZ5TTcGu-tM,THtcD`,YJgU1p,7))R,mlu'[o](CAi%&hcxK9Rs1aO@.mEUXCUH]va793+FvZRG%6)bvW#N2gV5?OgYrQ:J;#u.lCF2RarDsG*t'jQuPKBqkbY&_`686kN?p.a?L>bie.t7/f<>xrH]2CX<&>KI.,7HhnkeMb&SDQ5LZ7*J$5GGldT%(np9vbkKJ4bL#v#pqk5Vm1)r$uVfs5$avYe7i$aUH]Z3$*8o8HC#%]x$-I-=7YSFCUFCL.^,55U6;1_lZ%%[;,fFaMS7hFB<Mbs?NMirI8CLq`_=ono]*fNltW?TASX.WM6sc#*hNSf)c'SUx@1_U%3/`Xpim#HQ^-XE)sxYs(bbHfJNQgXEv;=]fn'L%0)_X`]]8U@,ejP2k=-=mkSlP?(n=/)R1^C[Ml*0$NwX40X]p;paL(oD=T5Tt8W#V],vQv^r$QHhGB;rD7-^<ZD<-GULPb-K9`Fvb4'>pHp6ma>'f;8rVE#_D<TK^kg75%#S7Ghl<_R(FEW`m:s]f6hG?6^+*Qh,D90W69DlhItD,LQeI+n?lbCw_IdYFTTW*-p/P9eFo_^DaUKaiaY?P%+;EPx]i0RbJ`eHx]l+ueT'eJ`9Z/Fv3WJv9Fdv[BF=R0<(1JKUj&*DJkWL(&vM#][Y>BorT+j8N_=Q1J>b<mqVix?qv<p%qRGN566%dRAphc7>9DOmF;uo/`V(iWN#KRLFUW.V$>-1lbfbG&Hh>Ff+aPIsR75,,k:?o^OCQS0N<r(98XDw#0D[AJYkj7S5h.hMX9+0mS0(R$G.&sG*h97[IN4:Qj-DJ2A.tpi*E+l%@;k&kn<aE:B0r>(-NlA/wq#PX)c7fL1bP/BMV-L,v1`FpB.to]<o_5$5hlFYgIja23wJVhlB(Z:)[g#ax/@$&I]4/4mVrFEY*gS<EZ.TgF)+(djVhR8Dqp1/LjR0:.s0iNVuAuZ_*9'ZXJe,D<sA2R_d[-q(>HI`8^4lHNcD(Mq#I2o-aSWXU.p[?]Iq1]W).S,_+qb#Ww*b)t9Fn4@2NmZkSAgA]sWq:.N&:wUjCXadm3capH/0%cfAMYRJrNV>e_JivNg*^`83UfZ/]]c'D3l?1'aS&Rn:cAs7N83xF.`$/7VfMj[oCLb#=pGD1OtwPp?;)7]m*b-u[#b:eb&ktb)p.p2Obg[dij`wiX)As/[k/:ABIDrD9'VEI*L)kl4-(G-G3Cc.tJ,ePB7.DJt`4/Z_T*D^lI>IL-(Bi>[Lg2*n@G]]qEG6dGFiBS<CLt3GM8ZaS:<e<Tg;HsTDMA^b(U[sfts)A-PE-QeFd0dXXD_`/xM5.m#o(tCZ2ES?EWW(Xkp3R<?2b:tGnSE2o4e^5kO`sox&;-baiN9'695W_=>*E`9)n6XsExt;IR2*f[,JZUmGt/lSGeh*rk4>u=i,=s#^8#+M#KfWxtApOPd.WQNFm4=glNT;;,gnJS?cibw'qA6G1K`]2wjl_]7v9`dqRvQd/0Dq-uR-PaW#/B)69AVQM$WIU'VaIg)gWCMQ)?GH@Src]?8&0(ONDSOw@Jo$IH,l?/Ya6r4?6;Xc1ODbJ^0gAjgH68SaZ8*%4'>.sg-%:3J`en6=KMQ+]WI>5#/iHPY3fU_<5*f.b.m@@4+]d^ucEKtpg^3nx-&.U*qnPS'$+(PFA@@3[`JYNTWAgpnn&'S2j`Swn?Q@2[=PD<6^=UQn'=1fl:$r9,vM;Ka`-pfb[)J@P5*#x'g#uu,';S%<Y5vSVm%epW_]W*`d@DpL3Mu&D7U^BM@ne]<KAM?oX(ieN=iss-,?;A0eCL9A'0A7h),ls9h>@d^?%bnHJLO+u$UGH[+TbZ=4rfBN8'5O'K0YLYGj(9PC3W%TG;uIX_si.mXbfsqY6t;x.4[-B&@Kk.`WrXhDV<2nKLQJhCf.41@o:ECWba4fl+m(L=X4haQFH:iSMWXXps;/R%gDO(]@qgFY@4`kSfpXOBFsxjgF_5DDThp$SMrCHmoOMd^VwppMJgWG9Y<gMQnsb5g#.u=Mt0g(1nGxbR)S0P(mk<YuoGeJsouwl]f>?&'K.0gBe?k)(7^A=9t&'dBpNnI1v$.F%,Z7,&SL&4j].63vmV_<c#.].G$9cCBWQn21[w1OchFHHxVj:_-B7-5W0vj'ME'l&E^$&E=Sw%t=)SE1/-/J_[Xri/pT&>TA4>8MA`f0n.W8Od+M)95f'l9l@8mEEN]0VVB/oM>99U0B4m]_%N&7sH$Yxi,S7g?$d^M+pJqF?aMZ'&+'1>7A)WY:V:&Vb.9qY#Q44kZ&#9qP(v#VB/8GTwKJ6(O&C+a;jf`lHOJW/rhh@50S'Zb;1,]]";

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,891 @@
<krpano>
<!--
webvr.xml
- krpano 1.19-pr14
-->
<!-- load the WebVR plugin and assign it to a 'webvr' variable for easier usage -->
<plugin name="webvr" devices="html5" keep="true"
url="webvr.js"
onloaded="copy(webvr, plugin[webvr]);"
mousespeed="0.00125"
multireslock="true"
fullscreen_mirroring="true"
mobilevr_support="true"
mobilevr_ipd="63.5"
mobilevr_screensize="auto"
mobilevr_lens_overlap="1.0"
mobilevr_lens_fov="96"
mobilevr_lens_dist="0.6"
mobilevr_lens_dist2="1|0|0|0"
mobilevr_lens_ca="0.0"
mobilevr_lens_vign="100"
mobilevr_wakelock="true"
mobilevr_sensor_mode="3"
mobilevr_autocalibration="false"
mobilevr_touch_support="true"
mobilevr_fake_support="false"
vr_cursor="hotspot[vr_cursor]"
vr_cursor_enabled="true"
vr_cursor_onover="if(handcursor, tween(hotspot[vr_cursor].scale,0.4,0.1); vr_auto_click(get(vr_timeout)); );"
vr_cursor_onout="tween(hotspot[vr_cursor].scale,0.3,0.1);"
onavailable="webvr_onavailable();"
onunavailable=""
onunknowndevice="webvr_onunknowndevice();"
onentervr="webvr_onentervr();"
onexitvr="webvr_onexitvr();"
/>
<!-- a custom xml data structure with the supported VR headsets -->
<vrheadsets>
<headset name="cb1" caption="Cardboard A" overlap="1.10" fov="96.0" dist="1.00" dist2="1|0|0|0" ca="0.000" vig="100" />
<headset name="cb2" caption="Cardboard B" overlap="1.00" fov="96.0" dist="0.60" dist2="1|0|0|0" ca="0.000" vig="100" />
<headset name="gvr" caption="GearVR" overlap="1.00" fov="112.0" dist="0.95" dist2="1|0|0|0" ca="0.090" vig="100" />
<headset name="hom" caption="HOMiDO" overlap="1.00" fov="101.0" dist="1.10" dist2="1|0|0|0" ca="0.075" vig="100" />
<headset name="one" caption="VR ONE" overlap="1.00" fov="109.9" dist="0.00" dist2="1.139|0.093|0.018|0.207" ca="0.090" vig="35" />
<headset name="ccr" caption="ColorCross VR" overlap="1.00" fov="70.0" dist="0.65" dist2="1|0|0|0" ca="0.000" vig="100" />
<headset name="nod" caption="No Distortion" overlap="1.00" fov="96.0" dist="0.00" dist2="1|0|0|0" ca="0.000" vig="100" />
</vrheadsets>
<!-- the VR cursor hotspot -->
<hotspot name="vr_cursor" keep="true"
url="webvr_cursor_80x80_17f.png"
visible="false"
enabled="false"
distorted="true"
crop="0|0|80|80"
scale="0.3"
depth="1000"
/>
<!-- vr_auto_click() - call this action in the onover event of a
hotspot to trigger automatically a click after some time. -->
<action name="vr_auto_click" scope="local" args="vr_aclk_timeout">
if(webvr.isenabled,
if(vr_aclk_timeout == null, set(vr_aclk_timeout, 2000));
copy(vr_aclk_t1, timertick);
set(vr_aclk_waiting, true);
copy(webvr.vr_aclk_hotspot, caller.name);
set(hotspot[vr_cursor].crop,'0|0|80|80');
asyncloop(vr_aclk_waiting AND webvr.vr_aclk_hotspot == caller.name,
sub(dt, timertick, vr_aclk_t1);
if(!caller.hovering,
set(vr_aclk_waiting, false);
set(hotspot[vr_cursor].crop,'0|0|80|80');
,
div(f, dt, vr_aclk_timeout);
mul(f, 16);
roundval(f);
Math.min(f, 16);
mul(f, 80);
txtadd(hotspot[vr_cursor].crop,get(f),'|0|80|80');
<!-- wait another 100ms delay after finishing the animation before doing the click -->
sub(dt, 100);
if(dt GT vr_aclk_timeout,
set(vr_aclk_waiting,false);
set(hotspot[vr_cursor].crop,'0|0|80|80');
<!-- call onclick -->
callwith(caller, onclick() );
);
);
);
);
</action>
<!-- by pressing SPACE the headset could be re-centered -->
<events name="webvr_events" devices="html5" keep="true"
onkeydown="if(webvr AND webvr.isenabled AND keycode==32, webvr.resetSensor() );"
onmousedown="if(webvr AND webvr.isenabled, webvr_showbuttons() );"
onexitfullscreen="vr_setup_close();"
/>
<!-- when WebVR support is available show an EnterVR button -->
<action name="webvr_onavailable">
webvr.loadsettings();
if(layer[webvr_enterbutton], delayedcall(0.5, tween(layer[webvr_enterbutton].alpha,1.0); ); );
</action>
<action name="webvr_onunknowndevice">
if(webvr.isfake AND device.desktop AND webvr.havesettings == false,
<!-- set the 'no distortion' headset for fake desktop usage -->
set(webvr.mobilevr_lens_overlap, 1.0);
set(webvr.mobilevr_lens_fov, 96.0);
set(webvr.mobilevr_lens_dist, 0.0);
set(webvr.mobilevr_lens_dist2, '1|0|0|0');
set(webvr.mobilevr_lens_ca, 0.0);
set(webvr.mobilevr_lens_vign, 100);
,
set(webvr.ask_user_for_screensize,true);
);
</action>
<action name="webvr_onentervr">
if(layer[webvr_enterbutton], tween(layer[webvr_enterbutton].alpha,0,0); );
webvr_showbuttons();
webvr_hide_all_non_vr_layers();
<!-- when the screen size is unknown an no custom size is set, open the setup screen on entering the VR mode -->
if(webvr.ismobilevr == true AND !webvr.isfake AND webvr.ask_user_for_screensize == true AND webvr.mobilevr_screensize == 'auto',
set(webvr.ask_user_for_screensize, false);
vr_setup();
);
if(webvr.isfake,
webvr_show_fakemode_info(true);
);
</action>
<action name="webvr_onexitvr">
stopdelayedcall(vr_button_fadeout);
if(layer[webvr_enterbutton], tween(layer[webvr_enterbutton].alpha,1); );
tween(layer[webvr_exitbutton].alpha,0);
tween(layer[webvr_setupbutton].alpha,0);
webvr_show_fakemode_info(false);
webvr_restore_layers();
</action>
<action name="webvr_hide_all_non_vr_layers" scope="local">
for(set(i,0), i LT layer.count, inc(i),
copy(lr, layer[get(i)]);
if(lr.vr !== true,
copy(lr.vr_backup_visible, lr.visible);
set(lr.visible, false);
);
);
</action>
<action name="webvr_restore_layers" scope="local">
for(set(i,0), i LT layer.count, inc(i),
copy(lr, layer[get(i)]);
if(lr.vr_backup_visible,
copy(lr.visible, lr.vr_backup_visible);
delete(lr.vr_backup_visible);
);
);
</action>
<action name="webvr_show_fakemode_info" scope="local" args="show">
if(show == true,
addlayer(webvr_fakemode_info);
set(layer[webvr_fakemode_info],
type='text',
keep=true,
align='bottom',
y=80,
bg=false,
css='color:#FFFFFF;text-align:center;',
html='[i][u]Simulated WebVR Mode![/u][/i][br]For real WebVR with headset tracking, either use a [a href="http://webvr.info" target="_blank" style="color:#FFFFFF;"]WebVR-API-capable[/a] desktop browser or a mobile device and a VR headset.'
);
,
removelayer(webvr_fakemode_info);
);
</action>
<!-- ensure the same scaling on mobiles (regardless if mobilescale is 0.5 or 1.0) -->
<krpano webvr_setup_scale="calc:(1.0 + 1.0*(device.mobile AND stagescale LT 1.0)) / (1.0 + 1.0*device.mobile)"
webvr_button_scale.normal="1.0"
webvr_button_scale.mobile="1.6"
/>
<!-- the EnterVR/ExitVR and SetupVR buttons -->
<style name="webvr_button_style"
type="text"
bgcolor="0x000000"
bgalpha="0.5"
bgroundedge="calc:9*webvr_setup_scale*webvr_button_scale"
css="calc:'color:#FFFFFF;font-size:' + 20*webvr_setup_scale*webvr_button_scale + 'px;'"
padding="calc:6*webvr_setup_scale*webvr_button_scale + ' ' + 10*webvr_setup_scale*webvr_button_scale"
/>
<layer name="webvr_enterbutton" keep="true" vr="true"
style="webvr_button_style"
html="Enter VR"
align="top" y="24"
autoalpha="true" alpha="0.0"
onclick="webvr.enterVR();"
/>
<layer name="webvr_exitbutton" keep="true" vr="true"
style="webvr_button_style"
html="Exit VR"
align="top" y="24"
autoalpha="true" alpha="0.0"
onclick="webvr.exitVR();"
/>
<layer name="webvr_setupbutton" keep="true" vr="true"
style="webvr_button_style"
html="VR Setup"
align="bottom" y="24"
autoalpha="true" alpha="0.0"
onclick="vr_setup();"
/>
<action name="webvr_showbuttons">
stopdelayedcall(vr_button_fadeout);
if(webvr.ismobilevr,
tween(layer[webvr_exitbutton].alpha|layer[webvr_setupbutton].alpha, 1.0|1.0, 0.25);
delayedcall(vr_button_fadeout, 3.0, tween(layer[webvr_exitbutton].alpha|layer[webvr_setupbutton].alpha, 0.0|0.0, 1.0); );
,
tween(layer[webvr_exitbutton].alpha, 1.0, 0.25);
delayedcall(vr_button_fadeout, 3.0, tween(layer[webvr_exitbutton].alpha, 0.0, 1.0); );
);
</action>
<!--
VR Setup
-->
<action name="vr_setup" scope="local">
<!-- store the setup settings in a 'vrsetup' object -->
if(webvr.vrsetup === null, def(webvr.vrsetup, object); );
copy(vrs, webvr.vrsetup);
<!-- disable cursor -->
set(webvr.vr_cursor_enabled, false);
<!-- hide VR buttons -->
tween(layer[webvr_exitbutton].alpha,0);
tween(layer[webvr_setupbutton].alpha,0);
<!-- create darken-background layer -->
addlayer(vr_setup_darken);
set(layer[vr_setup_darken], type='container', safearea=false, bgcolor=0x000000, bgalpha=0.5, bgcapture=true, handcursor=false, align='lefttop', width='100%', height='100%', zorder=99998);
<!-- create element container -->
addlayer(vr_setup_bg);
set(layer[vr_setup_bg], type='container', handcursor=false, align='lefttop', width='100%', height='100%', zorder=99999);
<!-- get and prepare device infos and settings -->
copy(i_screensize, webvr.mobilevr_screensize);
if(i_screensize == 'auto', copy(i_screensize, webvr.devicesize));
if(i_screensize LE 0, set(i_screensize, 5.0));
roundval(i_screensize, 1);
txtadd(i_screensize, ' inch');
copy(i_ipd, webvr.mobilevr_ipd);
roundval(i_ipd, 1);
txtadd(i_ipd, ' mm');
copy(i_fov, webvr.mobilevr_lens_fov);
roundval(i_fov, 1);
copy(i_dist, webvr.mobilevr_lens_dist);
roundval(i_dist, 2);
copy(i_dist2, webvr.mobilevr_lens_dist2);
txtsplit(i_dist2, '|', vrs.i_dist2_k1, vrs.i_dist2_k2, vrs.i_dist2_k3, vrs.i_dist2_k4);
mul(vrs.i_dist2_k1,1);
mul(vrs.i_dist2_k2,10);
mul(vrs.i_dist2_k3,10);
mul(vrs.i_dist2_k4,10);
roundval(vrs.i_dist2_k1,2);
roundval(vrs.i_dist2_k2,2);
roundval(vrs.i_dist2_k3,2);
roundval(vrs.i_dist2_k4,2);
copy(i_vig, webvr.mobilevr_lens_vign);
roundval(i_vig, 0);
copy(i_overlap, webvr.mobilevr_lens_overlap);
roundval(i_overlap, 2);
copy(i_ca, webvr.mobilevr_lens_ca);
roundval(i_ca, 3);
set(i_headset, 'Custom');
for(set(i,0), i LT vrheadsets.headset.count, inc(i),
copy(hs, vrheadsets.headset[get(i)]);
if(i_overlap == hs.overlap AND i_fov == hs.fov AND i_dist == hs.dist AND i_dist2 == hs.dist2 AND i_ca == hs.ca AND i_vig == hs.vig,
copy(i_headset, hs.caption);
);
);
<!-- when the screen size is unknown, mark it red -->
set(known_size, true);
set(sizcol, #FFFFFF);
copy(i_devicename, webvr.devicename);
if(i_devicename == 'Unknown',
if(webvr.mobilevr_screensize == 'auto',
set(sizcol, #AA0000);
set(known_size, false);
,
set(i_devicename, 'Custom');
);
);
<!-- create layer for the main menu -->
addlayer(vr_setup_m1);
set(layer[vr_setup_m1], type='container', parent='vr_setup_bg', align='lefttop', width='100%', height='100%');
<!-- create layer for the headset customization menu -->
addlayer(vr_setup_m3);
set(layer[vr_setup_m3], type='container', parent='vr_setup_bg', align='lefttop', width='100%', height='100%', visible=false);
<!-- create layer for the calibration menu -->
addlayer(vr_setup_m2);
set(layer[vr_setup_m2], type='container', parent='vr_setup_bg', align='lefttop', width='100%', height='100%', visible=false);
<!-- create the text elements -->
set(vrs.vr_setup_text_parent, 'vr_setup_m1');
vr_setup_createtext(vr_setup_title, 'MOBILE VR SETUP', center, center, 0, -225, #FFFFFF, false);
vr_setup_createtext(vr_setup_dvn1, 'Device:', center, right, 0, -145, #FFFFFF, true, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_dvn2, get(i_devicename), center, left, 0, -145, get(sizcol), true, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_siz1, 'Screensize:', center, right, 0, -105, #FFFFFF, true, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_siz2, get(i_screensize), center, left, 0, -105, get(sizcol), true, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_ipd1, 'IPD:', center, right, 0, -35, #FFFFFF, true, vr_setup_select('ipd') );
vr_setup_createtext(vr_setup_ipd2, get(i_ipd), center, left, 0, -35, #FFFFFF, true, vr_setup_select('ipd') );
vr_setup_createtext(vr_setup_hmd1, 'VR Headset:', center, right, 0, +35, #FFFFFF, true, vr_setup_select('headset') );
vr_setup_createtext(vr_setup_hmd2, get(i_headset), center, left, 0, +35, #FFFFFF, true, vr_setup_select('headset') );
vr_setup_createtext(vr_setup_hmd3, 'Customize', center, center, 0, +75, #FFFFFF, true, set(bg,true), set(bg,false), vr_setup_customize_headset() );
if(webvr.iswebvr == false,
vr_setup_createtext(vr_setup_cal, 'Calibrate Gyroscope', center, center, 0, +145, #FFFFFF, true, set(bg,true), set(bg,false), vr_setup_calibration() );
);
vr_setup_createtext(vr_setup_sav, 'SAVE', center, center, -200, +225, #FFFFFF, true, set(bg,true), set(bg,false), vr_setup_save() );
vr_setup_createtext(vr_setup_rst, 'RESET', center, center, 0, +225, #FFFFFF, true, set(bg,true), set(bg,false), vr_setup_reset() );
vr_setup_createtext(vr_setup_cls, 'CLOSE', center, center, +200, +225, #FFFFFF, true, set(bg,true), set(bg,false), vr_setup_close() );
<!-- and the adjusting buttons -->
vr_setup_createbutton(vr_setup_btn1, '&#60;', left, left, 5%, -35, #FFFFFF, true, null);
vr_setup_createbutton(vr_setup_btn2, '&#62;', right, right, 5%, -35, #FFFFFF, true, null);
<!-- create the customize_headset text elements -->
set(vrs.vr_setup_text_parent, 'vr_setup_m3');
vr_setup_createtext(vr_setup_m31, 'VR HEADSET', center, center, 0, -225, #FFFFFF, false);
vr_setup_createtext(vr_setup_fov1, 'FOV:', center, right, 0, -80, #FFFFFF, true, vr_setup_select('fov') );
vr_setup_createtext(vr_setup_fov2, get(i_fov), center, left, 0, -80, #FFFFFF, true, vr_setup_select('fov') );
vr_setup_createtext(vr_setup_dst1, 'Distortion:', center, right, 0, -32, #FFFFFF, true, vr_setup_select('dist') );
vr_setup_createtext(vr_setup_dst2, get(i_dist), center, left, 0, -32, #FFFFFF, true, vr_setup_select('dist') );
vr_setup_createtext(vr_setup_d2tx, 'Dist2:', center, right, 0, +16, #FFFFFF, true, vr_setup_select('dist2k1') );
vr_setup_createtext(vr_setup_d2k1, get(vrs.i_dist2_k1), center, left, 0, +16, #FFFFFF, true, vr_setup_select('dist2k1') );
vr_setup_createtext(vr_setup_d2k2, get(vrs.i_dist2_k2), center, left, +100, +16, #FFFFFF, true, vr_setup_select('dist2k2') );
vr_setup_createtext(vr_setup_d2k3, get(vrs.i_dist2_k3), center, left, +200, +16, #FFFFFF, true, vr_setup_select('dist2k3') );
vr_setup_createtext(vr_setup_d2k4, get(vrs.i_dist2_k4), center, left, +300, +16, #FFFFFF, true, vr_setup_select('dist2k4') );
vr_setup_createtext(vr_setup_cac1, 'CA Corr:', center, right, 0, +64, #FFFFFF, true, vr_setup_select('ca') );
vr_setup_createtext(vr_setup_cac2, get(i_ca), center, left, 0, +64, #FFFFFF, true, vr_setup_select('ca') );
vr_setup_createtext(vr_setup_vig1, 'Vignette:', center, right, 0, +112, #FFFFFF, true, vr_setup_select('vignette') );
vr_setup_createtext(vr_setup_vig2, get(i_vig), center, left, 0, +112, #FFFFFF, true, vr_setup_select('vignette') );
vr_setup_createtext(vr_setup_olp1, 'Overlap:', center, right, 0, +160, #FFFFFF, true, vr_setup_select('overlap') );
vr_setup_createtext(vr_setup_olp2, get(i_overlap), center, left, 0, +160, #FFFFFF, true, vr_setup_select('overlap') );
vr_setup_createtext(vr_setup_m35, 'CLOSE', center, center, 0, +225, #FFFFFF, true, set(bg,true), set(bg,false), vr_setup_close_sub_menus() );
<!-- create the calibration text elements -->
set(vrs.vr_setup_text_parent, 'vr_setup_m2');
vr_setup_createtext(vr_setup_cb1, 'GYROSCOPE', center, center, 0, -225, #FFFFFF, false);
vr_setup_createtext(vr_setup_cb2, 'Place the device on a flat and[br]stable surface and tab calibrate[br]to correct a gyroscope drifting.', center, center, 0, -95, #FFFFFF, false, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_cb3, 'CALIBRATE', center, center, 0, +55, #FFFFFF, true, set(bg,true), set(bg,false), vr_setup_do_calibration() );
vr_setup_createtext(vr_setup_cb4, 'RESET', center, center, 0, +125, #FFFFFF, true, set(bg,true), set(bg,false), webvr.resetcalibration() );
vr_setup_createtext(vr_setup_cb5, 'CLOSE', center, center, 0, +225, #FFFFFF, true, set(bg,true), set(bg,false), vr_setup_close_sub_menus() );
vr_setup_createtext(vr_setup_cb6, 'Calibrating...', bottom, center, 0, 40, #FFFFFF, false, null );
vr_setup_createtext(vr_setup_cb7, 'Calibration okay.', bottom, center, 0, 40, #FFFFFF, false, null );
vr_setup_createtext(vr_setup_cb8, 'Calibration failed!', bottom, center, 0, 40, #FFFFFF, false, null );
set(layer[vr_setup_cb6].autoalpha, true);
set(layer[vr_setup_cb7].autoalpha, true);
set(layer[vr_setup_cb8].autoalpha, true);
set(layer[vr_setup_cb6].alpha, 0.0);
set(layer[vr_setup_cb7].alpha, 0.0);
set(layer[vr_setup_cb8].alpha, 0.0);
<!-- pre-select the screen size for adjusting when it is unknown, otherwise the IPD -->
if(known_size == false,
vr_setup_select('screen', true);
,
vr_setup_select('ipd', true);
);
</action>
<action name="vr_setup_createtext" scope="local" args="layername, text, align, edge, x, y, color, enabled, ondown, onup, onclick">
addlayer(get(layername));
set(layer[get(layername)],
parent=get(webvr.vrsetup.vr_setup_text_parent),
type='text',
css=calc('text-align:' + (align == 'bottom' ? 'center' : align) + ';color:' + color + ';font-size:' + (40 * webvr_setup_scale) + 'px;font-weight:bold;'),
padding=calc(0 + ' ' + (8 * webvr_setup_scale)),
bgroundedge=calc(8 * webvr_setup_scale),
bg=false,
bgcolor=0xFFFFFF,
bgalpha=0.25,
align=get(align),
edge=get(edge),
x=calc(x * webvr_setup_scale),
y=calc(y * webvr_setup_scale),
html=get(text),
enabled=get(enabled),
ondown=get(ondown),
onup=get(onup),
onclick=get(onclick)
);
</action>
<action name="vr_setup_createbutton" scope="local" args="layername, text, align, edge, x, y, color, enabled, ondown, onup, onclick">
vr_setup_createtext(get(layername), get(text), get(align), get(edge), get(x), get(y), get(color), get(enabled), get(ondown), get(onup), get(onclick));
set(layer[get(layername)],
css=calc('vertical-align:middle;text-align:center;color:' + color + ';font-size:' + (60 * webvr_setup_scale) + 'px;font-weight:bold;'),
bg=true,
padding=0,
bgroundedge=calc(40 * webvr_setup_scale),
width=calc(70 * webvr_setup_scale),
height=calc(70 * webvr_setup_scale),
vcenter=true
);
</action>
<action name="vr_setup_reset" scope="local">
<!-- reset to the defaults -->
set(webvr.mobilevr_screensize, 'auto');
copy(i_screensize, webvr.devicesize);
if(i_screensize LE 0, set(i_screensize, 5.0); );
roundval(i_screensize, 1);
set(layer[vr_setup_dvn2].html, get(webvr.devicename));
txtadd(layer[vr_setup_siz2].html, get(i_screensize), ' inch');
set(webvr.mobilevr_ipd, 63.5);
copy(i_ipd, webvr.mobilevr_ipd);
roundval(i_ipd, 1);
txtadd(layer[vr_setup_ipd2].html, get(i_ipd), ' mm');
<!-- set fake custom lens settings and call 'next' headset to switch to the default 'Cardboard' settings -->
set(webvr.mobilevr_lens_fov, 100);
set(webvr.mobilevr_lens_dist, 0.5);
set(webvr.mobilevr_lens_dist2, '1|0|0|0');
set(webvr.mobilevr_lens_vign, 100);
set(webvr.mobilevr_lens_overlap, 1.0);
set(webvr.mobilevr_lens_ca, 0.0);
if(webvr.isfake AND device.desktop,
<!-- select 'no distortion' headset for fake desktop usage -->
vr_setup_change_headset(-1);
,
<!-- select 'Cardboard A' headset for Mobile-VR usage -->
vr_setup_change_headset(+1);
);
copy(vrs, webvr.vrsetup);
vr_setup_select(get(vrs.var), true);
</action>
<action name="vr_setup_close">
<!-- 2. parameter == true => remove children elements too -->
removelayer(vr_setup_darken, true);
removelayer(vr_setup_bg, true);
<!-- enable cursor -->
set(webvr.vr_cursor_enabled, true);
</action>
<action name="vr_setup_save">
webvr.saveSettings();
vr_setup_close();
</action>
<action name="vr_setup_customize_headset" scope="local">
set(layer[vr_setup_darken].bgalpha, 0.1);
set(layer[vr_setup_m1].visible,false);
set(layer[vr_setup_m2].visible,false);
set(layer[vr_setup_m3].visible,true);
set(layer[vr_setup_hmd1].parent, vr_setup_m3);
set(layer[vr_setup_hmd2].parent, vr_setup_m3);
set(layer[vr_setup_btn1].parent, vr_setup_m3);
set(layer[vr_setup_btn2].parent, vr_setup_m3);
set(layer[vr_setup_hmd1].y, calc(-145 * webvr_setup_scale));
set(layer[vr_setup_hmd2].y, calc(-145 * webvr_setup_scale));
copy(vrs, webvr.vrsetup);
copy(vrs.old_selection, vrs.var);
vr_setup_select('headset');
</action>
<action name="vr_setup_calibration">
set(layer[vr_setup_m1].visible,false);
set(layer[vr_setup_m2].visible,true);
</action>
<action name="vr_setup_close_sub_menus" scope="local">
set(layer[vr_setup_darken].bgalpha, 0.5);
set(layer[vr_setup_m1].visible,true);
set(layer[vr_setup_m2].visible,false);
set(layer[vr_setup_m3].visible,false);
set(layer[vr_setup_hmd1].parent, vr_setup_m1);
set(layer[vr_setup_hmd2].parent, vr_setup_m1);
set(layer[vr_setup_btn1].parent, vr_setup_m1);
set(layer[vr_setup_btn2].parent, vr_setup_m1);
set(layer[vr_setup_hmd1].y, calc(+35 * webvr_setup_scale));
set(layer[vr_setup_hmd2].y, calc(+35 * webvr_setup_scale));
copy(vrs, webvr.vrsetup);
if(vrs.old_selection,
vr_setup_select(get(vrs.old_selection));
delete(vrs.old_selection);
);
</action>
<action name="vr_setup_do_calibration">
if(!webvr.isfake,
tween(layer[vr_setup_cb6].alpha, 1.0, 0.1);
tween(layer[vr_setup_cb7].alpha, 0.0, 0.1);
tween(layer[vr_setup_cb8].alpha, 0.0, 0.1);
webvr.calibrate(
tween(layer[vr_setup_cb6].alpha, 0.0, 0.1);
tween(layer[vr_setup_cb7].alpha, 1.0, 0.1);
delayedcall(2.0, tween(layer[vr_setup_cb7].alpha, 0.0, 0.25) );
,
tween(layer[vr_setup_cb6].alpha, 0.0, 0.1);
tween(layer[vr_setup_cb8].alpha, 1.0, 0.1);
delayedcall(2.0, tween(layer[vr_setup_cb8].alpha, 0.0, 0.25) );
);
);
</action>
<action name="vr_setup_update_dist2" scope="local">
copy(vrs, webvr.vrsetup);
txtadd(webvr.mobilevr_lens_dist2, get(vrs.i_dist2_k1), '|', calc(vrs.i_dist2_k2/10.0), '|', calc(vrs.i_dist2_k3/10.0), '|', calc(vrs.i_dist2_k4/10.0));
vr_setup_change_headset(0);
</action>
<action name="vr_setup_select" scope="local" args="selected_var, noanimation">
copy(vrs, webvr.vrsetup);
<!-- select a setting for adjusting -->
set(layer[vr_setup_siz2].bg, false);
set(layer[vr_setup_ipd2].bg, false);
set(layer[vr_setup_hmd2].bg, false);
set(layer[vr_setup_fov2].bg, false);
set(layer[vr_setup_dst2].bg, false);
set(layer[vr_setup_d2k1].bg, false);
set(layer[vr_setup_d2k2].bg, false);
set(layer[vr_setup_d2k3].bg, false);
set(layer[vr_setup_d2k4].bg, false);
set(layer[vr_setup_vig2].bg, false);
set(layer[vr_setup_cac2].bg, false);
set(layer[vr_setup_olp2].bg, false);
set(layer[vr_setup_btn1].ondown, vr_setup_change_ondown(-1) );
set(layer[vr_setup_btn2].ondown, vr_setup_change_ondown(+1) );
set(vrs.setting, null);
set(vrs.var, get(selected_var));
set(vrs.var_value, null);
set(vrs.var_callback, null);
if(selected_var == 'screen',
set(vrs.setting, vr_setup_siz2);
set(vrs.var_name, 'webvr.mobilevr_screensize');
set(vrs.var_postfix, ' inch');
copy(vrs.var_value, get(vrs.var_name));
if(vrs.var_value == 'auto', copy(vrs.var_value, webvr.devicesize));
if(vrs.var_value LE 0, set(vrs.var_value, 5.0));
set(vrs.var_step, 0.1);
set(vrs.var_min, 4);
set(vrs.var_max, 10);
set(vrs.var_round, 1);
set(vrs.var_callback, vr_setup_change_screen() );
);
if(selected_var == 'ipd',
set(vrs.setting, vr_setup_ipd2);
set(vrs.var_name, 'webvr.mobilevr_ipd');
set(vrs.var_postfix, ' mm');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.1);
set(vrs.var_min, 40);
set(vrs.var_max, 80);
set(vrs.var_round, 1);
);
if(selected_var == 'headset',
set(vrs.setting, vr_setup_hmd2);
set(layer[vr_setup_btn1].ondown, vr_setup_change_headset(-1) );
set(layer[vr_setup_btn2].ondown, vr_setup_change_headset(+1) );
);
if(selected_var == 'fov',
set(vrs.setting, vr_setup_fov2);
set(vrs.var_name, 'webvr.mobilevr_lens_fov');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.1);
set(vrs.var_min, 40);
set(vrs.var_max, 179);
set(vrs.var_round, 1);
set(vrs.var_callback, vr_setup_change_headset(0) );
);
if(selected_var == 'dist',
set(vrs.setting, vr_setup_dst2);
set(vrs.var_name, 'webvr.mobilevr_lens_dist');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.01);
set(vrs.var_min, 0);
set(vrs.var_max, 5);
set(vrs.var_round, 2);
set(vrs.var_callback, vr_setup_change_headset(0) );
);
if(selected_var == 'dist2k1',
set(vrs.setting, vr_setup_d2k1);
set(vrs.var_name, 'webvr.vrsetup.i_dist2_k1');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.01);
set(vrs.var_min, -9);
set(vrs.var_max, +9);
set(vrs.var_round, 2);
set(vrs.var_callback, vr_setup_update_dist2() );
);
if(selected_var == 'dist2k2',
set(vrs.setting, vr_setup_d2k2);
set(vrs.var_name, 'webvr.vrsetup.i_dist2_k2');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.01);
set(vrs.var_min, -9);
set(vrs.var_max, +9);
set(vrs.var_round, 2);
set(vrs.var_callback, vr_setup_update_dist2() );
);
if(selected_var == 'dist2k3',
set(vrs.setting, vr_setup_d2k3);
set(vrs.var_name, 'webvr.vrsetup.i_dist2_k3');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.01);
set(vrs.var_min, -9);
set(vrs.var_max, +9);
set(vrs.var_round, 2);
set(vrs.var_callback, vr_setup_update_dist2() );
);
if(selected_var == 'dist2k4',
set(vrs.setting, vr_setup_d2k4);
set(vrs.var_name, 'webvr.vrsetup.i_dist2_k4');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.01);
set(vrs.var_min, -9);
set(vrs.var_max, +9);
set(vrs.var_round, 2);
set(vrs.var_callback, vr_setup_update_dist2() );
);
if(selected_var == 'vignette',
set(vrs.setting, vr_setup_vig2);
set(vrs.var_name, 'webvr.mobilevr_lens_vign');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 1);
set(vrs.var_min, 10);
set(vrs.var_max, 200);
set(vrs.var_round, 0);
set(vrs.var_callback, vr_setup_change_headset(0) );
);
if(selected_var == 'ca',
set(vrs.setting, vr_setup_cac2);
set(vrs.var_name, 'webvr.mobilevr_lens_ca');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.01);
set(vrs.var_min, -1.0);
set(vrs.var_max, +1.0);
set(vrs.var_round, 2);
set(vrs.var_callback, vr_setup_change_headset(0) );
);
if(selected_var == 'overlap',
set(vrs.setting, vr_setup_olp2);
set(vrs.var_name, 'webvr.mobilevr_lens_overlap');
set(vrs.var_postfix, '');
copy(vrs.var_value, get(vrs.var_name));
set(vrs.var_step, 0.01);
set(vrs.var_min, 0.5);
set(vrs.var_max, 2.0);
set(vrs.var_round, 2);
set(vrs.var_callback, vr_setup_change_headset(0) );
);
if(vrs.setting != null,
set(layer[get(vrs.setting)].bg, true);
if(noanimation == true,
set(layer[vr_setup_btn1].y, get(layer[get(vrs.setting)].y));
set(layer[vr_setup_btn2].y, get(layer[get(vrs.setting)].y));
,
tween(layer[vr_setup_btn1].y, get(layer[get(vrs.setting)].y));
tween(layer[vr_setup_btn2].y, get(layer[get(vrs.setting)].y));
);
);
</action>
<action name="vr_setup_change_screen" scope="local">
set(layer[vr_setup_dvn2].html, 'Custom');
set(layer[vr_setup_dvn2].css, calc('color:#FFFFFF;font-size:'+40*webvr_setup_scale+'px;font-weight:bold;'));
set(layer[vr_setup_siz2].css, calc('color:#FFFFFF;font-size:'+40*webvr_setup_scale+'px;font-weight:bold;'));
</action>
<action name="vr_setup_change_ondown" scope="local">
copy(t0,timertick);
set(t1,0);
asyncloop(caller.pressed,
copy(t2,timertick);
sub(dt,t2,t1);
if(dt GT 100,
copy(t1,t2);
sub(dt,t1,t0);
div(dt,1000);
Math.max(dt,1);
mul(dt,%1);
vr_setup_adjust(get(dt));
);
);
</action>
<action name="vr_setup_adjust" scope="local">
copy(vrs, webvr.vrsetup);
if(vrs.setting != null,
mul(change, vrs.var_step, %1);
add(vrs.var_value, change);
Math.max(vrs.var_value, vrs.var_min);
Math.min(vrs.var_value, vrs.var_max);
roundval(vrs.var_value, get(vrs.var_round));
tween(get(vrs.var_name), get(vrs.var_value), 0.1);
txtadd(layer[get(vrs.setting)].html, get(vrs.var_value), get(vrs.var_postfix));
if(vrs.var_callback != null, vrs.var_callback());
);
</action>
<action name="vr_setup_change_headset" scope="local" args="indexchange">
set(i_headset, 'Custom');
if(indexchange != 0,
copy(i_fov, webvr.mobilevr_lens_fov);
roundval(i_fov, 1);
copy(i_dist, webvr.mobilevr_lens_dist);
roundval(i_dist, 2);
copy(i_dist2, webvr.mobilevr_lens_dist2);
copy(i_vig, webvr.mobilevr_lens_vign);
roundval(i_vig, 0);
copy(i_ca, webvr.mobilevr_lens_ca);
roundval(i_ca, 3);
copy(i_overlap, webvr.mobilevr_lens_overlap);
roundval(i_overlap, 2);
set(i_hsindex, -1);
copy(i_hscount, vrheadsets.headset.count);
for(set(i,0), i LT i_hscount, inc(i),
copy(hs, vrheadsets.headset[get(i)]);
if(i_overlap == hs.overlap AND i_fov == hs.fov AND i_dist == hs.dist AND i_dist2 == hs.dist2 AND i_ca == hs.ca AND i_vig == hs.vig,
copy(i_hsindex, i);
copy(i_headset, hs.caption);
);
);
if(indexchange GT 0,
add(i_hsindex, 1);
if(i_hsindex GE i_hscount, set(i_hsindex,0));
,
sub(i_hsindex, 1);
if(i_hsindex LT 0, sub(i_hsindex,i_hscount,1));
);
copy(hs, vrheadsets.headset[get(i_hsindex)]);
copy(i_headset, hs.caption);
copy(i_overlap, hs.overlap);
copy(i_fov, hs.fov);
copy(i_dist, hs.dist);
copy(i_dist2, hs.dist2);
copy(i_ca, hs.ca);
copy(i_vig, hs.vig);
);
copy(layer[vr_setup_hmd2].html, i_headset);
if(indexchange != 0,
copy(webvr.mobilevr_lens_overlap, i_overlap);
copy(webvr.mobilevr_lens_fov, i_fov);
copy(webvr.mobilevr_lens_dist, i_dist);
copy(webvr.mobilevr_lens_dist2, i_dist2);
copy(webvr.mobilevr_lens_ca, i_ca);
copy(webvr.mobilevr_lens_vign, i_vig);
copy(layer[vr_setup_olp2].html, i_overlap);
copy(layer[vr_setup_fov2].html, i_fov);
copy(layer[vr_setup_dst2].html, i_dist);
txtsplit(i_dist2, '|', i_dist2_k1, i_dist2_k2, i_dist2_k3, i_dist2_k4);
mul(i_dist2_k1,1);
mul(i_dist2_k2,10);
mul(i_dist2_k3,10);
mul(i_dist2_k4,10);
roundval(i_dist2_k1,2);
roundval(i_dist2_k2,2);
roundval(i_dist2_k3,2);
roundval(i_dist2_k4,2);
copy(layer[vr_setup_d2k1].html, i_dist2_k1);
copy(layer[vr_setup_d2k2].html, i_dist2_k2);
copy(layer[vr_setup_d2k3].html, i_dist2_k3);
copy(layer[vr_setup_d2k4].html, i_dist2_k4);
copy(layer[vr_setup_cac2].html, i_ca);
copy(layer[vr_setup_vig2].html, i_vig);
);
</action>
</krpano>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB