大家都能找到下面代码中高亮的部分:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<skin_settings maps="true" maps_type="bing" maps_bing_api_key="" maps_zoombuttons="false" gyro="true" title="false" thumbs="true" thumbs_width="120" thumbs_height="80" thumbs_padding="10" thumbs_crop="" thumbs_opened="false" thumbs_text="true" thumbs_dragging="true" thumbs_onhoverscrolling="false" thumbs_scrollbuttons="true" thumbs_scrollindicator="false" tooltips_thumbs="false" tooltips_hotspots="false" tooltips_mapspots="false" controlbar_offset="20" /> |
也就是thumbs_opened=”false” 将它改为 thumbs_opened=”true”
这样我们打开场景时下方缩略图是默认显示的。但尽管我们已经改为true了,若在手机上看是缩略图默认还是隐藏的,怎么回事呢?
我们打开skin文件夹的vtourskin.xml,我们找到下面的代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<action name="skin_startup"> if(device.mobile == false, copy(layer[skin_control_bar].y, skin_settings.controlbar_offset); copy(layer[skin_control_bar].y_opened, skin_settings.controlbar_offset); add(layer[skin_scroll_window].y, layer[skin_control_bar].height, layer[skin_control_bar].y); add(layer[skin_scroll_window].y_opened, layer[skin_control_bar].height, layer[skin_control_bar].y_opened); if(skin_settings.thumbs, if(skin_settings.thumbs_opened, set(layer[skin_thumbs].state,'opened'); set(layer[skin_thumbs_container].visible,true); ); copy(layer[skin_thumbs].draggable, skin_settings.thumbs_dragging); if(skin_settings.thumbs_onhoverscrolling, if(device.mouse, set(layer[skin_thumbs].draggable, false)); set(layer[skin_thumbs].onhover_autoscrolling, true); ); ); ); |
我们找到第九行高亮的代码,实际上就是控制缩略图是否在启动时显示的:
1 |
if(skin_settings.thumbs_opened, set(layer[skin_thumbs].state,'opened'); set(layer[skin_thumbs_container].visible,true); ); |
这上面是一个简单if控制,看刚才我们设定的属性是否为true,如果是的话就设置缩略图图层可见性为真。但是呢,这个简单的if实际上是被包含在一个更大的if,也就是上面的第二行。
1 |
if(device.mobile == false, |
也就是说,只有在非手机的设备上,才会进行这样的检查。因此如果在手机上的话,压根就不会理财我们设置的thumbs_opened 是否为true。所以我们需要把这个简单的if判断放到判断设备的if语句外面,才能声效。于是我们把代码改为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<action name="skin_startup"> if(skin_settings.thumbs_opened, set(layer[skin_thumbs].state,'opened'); set(layer[skin_thumbs_container].visible,true); ); if(device.mobile == false, copy(layer[skin_control_bar].y, skin_settings.controlbar_offset); copy(layer[skin_control_bar].y_opened, skin_settings.controlbar_offset); add(layer[skin_scroll_window].y, layer[skin_control_bar].height, layer[skin_control_bar].y); add(layer[skin_scroll_window].y_opened, layer[skin_control_bar].height, layer[skin_control_bar].y_opened); if(skin_settings.thumbs, copy(layer[skin_thumbs].draggable, skin_settings.thumbs_dragging); if(skin_settings.thumbs_onhoverscrolling, if(device.mouse, set(layer[skin_thumbs].draggable, false)); set(layer[skin_thumbs].onhover_autoscrolling, true); ); ); ); |
这样的话,缩略图是否显示就不受设备判断语句影响了。
在 “让官方皮肤在手机展示时也默认弹出缩略图(1.18)” 上有 2 条评论