您的位置:首页 > 其它

选择部分热点不在VR模式中显示

2017-03-22 18:00 281 查看
截至krpano 1.19 pr5,在VR中支持的热点只有distorted为true的图像热点,这些图像热点可能是链接到其它场景,或者是弹出图片,如果是后者的话,在VR中是有问题的,我们希望在VR下,这些用途为弹出图片的热点不要显示,只在正常模式下显示。

我们有下面两种用途的热点:

<hotspot name="spot2" style="skin_hotspotstyle" ath="42.657" atv="24.198" linkedscene="scene_02mt" />

<hotspot name="spot3" style="hotspotstyle|normalhs" ath="22.657" atv="14.198" onclick="openpic()" />

1
2
3

<hotspotname="spot2"style="skin_hotspotstyle"ath="42.657"atv="24.198"linkedscene="scene_02mt"/>

<hotspotname="spot3"style="hotspotstyle|normalhs" ath="22.657"atv="14.198"onclick="openpic()"/>

spot2是用于链接到其它scene里的,而spot3是弹出图片的。我们给spot3加了一个style为normalhs,如下。在这个例子中,所有不想在VR中显示的但distorted为true的图像热点,我们都加上这个设置:

<style name="normalhs" normal="false" onloaded="if(webvr.isenabled,set(visible,false),set(visible,true));" />

1

<style name="normalhs"normal="false"onloaded="if(webvr.isenabled,set(visible,false),set(visible,true));" />

注意,如果所加的热点本身有onloaded。例如,

<hotspot name="spot3" style="hotspotstyle" ath="22.657" atv="14.198" onclick="openpic()" onloaded="otheraction();" />

1

<hotspotname="spot3"style="hotspotstyle" ath="22.657"atv="14.198"onclick="openpic()"onloaded="otheraction();"/>

这样的话,需要把normalhs单独写出来。写成

<hotspot name="spot3" style="hotspotstyle" ath="22.657" atv="14.198" onclick="openpic()" normal="false" onloaded="if(webvr.isenabled,set(visible,false),set(visible,true));otheraction();" />

1

<hotspotname="spot3"style="hotspotstyle" ath="22.657"atv="14.198"onclick="openpic()"normal="false"onloaded="if(webvr.isenabled,set(visible,false),set(visible,true));otheraction();" />

然后tour.xml加入下面代码,在scene外,上面style元素也一样是放在scene外面。

<action name="normalhs_enterVR">
for(set(i,0), i LT hotspot.count, inc(i),
if(hotspot[get(i)].normal == false ,
set(hotspot[get(i)].visible, false);
);
);
</action>

<action name="normalhs_exitVR">
for(set(i,0), i LT hotspot.count, inc(i),
if(hotspot[get(i)].normal == false ,
set(hotspot[get(i)].visible, true);
);
);

</action>

1

2
3

4
5

6
7

8
9

10
11

12
13

14
15

16

<action name="normalhs_enterVR">

for(set(i,0),i
LThotspot.count,inc(i),

if(hotspot[get(i)].normal==
false,

set(hotspot[get(i)].visible,false);

);

);

</action>

<action name="normalhs_exitVR">

for(set(i,0),i
LThotspot.count,inc(i),

if(hotspot[get(i)].normal==
false,

set(hotspot[get(i)].visible,true);

);

);

</action>

这两段action就是控制进入VR和退出VR是控制那些含有normal属性且数值为false的热点的显示和隐藏。我们在代码中使用了循环,然后对属性进行了判断,然后设置其visible。

另外在tour.xml加入下面代码(一定要在第三行include代码的后面写,这样才能覆盖掉vtourskin里面的webvr插件设定),将normalhs_enterVRnormalhs_exitVR的调用分别加入到onentervronexitvr两个事件当中。

<plugin name="WebVR" keep="true" devices="html5"
pluginurl="%SWFPATH%/plugins/webvr.js"
url=""
multireslock.desktop="true"
multireslock.mobile.or.tablet="false"
mobilevr_support="true"
mobilevr_fake_support="true"
onavailable="removelayer(webvr_enterbutton); skin_arrange_buttons(); webvr_onavailable();"
onentervr="normalhs_enterVR();skin_showloading(false); webvr_onentervr(); webvr_setup(); skin_reloadscene_webvr();"
onexitvr="webvr_onexitvr(); webvr_setup(); skin_reloadscene_webvr();normalhs_exitVR();"
/>

1
2
3
4
5
6
7
8
9

10
11

<pluginname="WebVR"keep="true"devices="html5"

pluginurl="%SWFPATH%/plugins/webvr.js"
url=""

multireslock.desktop="true"
multireslock.mobile.or.tablet="false"

mobilevr_support="true"
mobilevr_fake_support="true"

onavailable="removelayer(webvr_enterbutton); skin_arrange_buttons(); webvr_onavailable();"

onentervr="normalhs_enterVR();skin_showloading(false); webvr_onentervr(); webvr_setup(); skin_reloadscene_webvr();"

onexitvr="webvr_onexitvr(); webvr_setup(); skin_reloadscene_webvr();normalhs_exitVR();"
/>

参考:sparselight.cn
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐