tour.xmlと同じディレクトリにpolyPosition.xmlファイルを作成します。
次に、polyPosition.xmlプラグインをtour.xmlファイルに直接インポートします。
つまり、tour.xmlの<krpano>タグの2行目に<include url = "polyPosition.xml" />と記述します。
polyPosition.xmlプラグインコードは次のとおりです。
<krpano>
<hotspot name="testspot" keep="true" visible="false" capture="false">
<point ath="" atv="" />
<point ath="" atv="" />
<point ath="" atv="" />
<point ath="" atv="" />
</hotspot>
<action name="createVar" autorun="onstart">
initLimit();
</action>
<action name="initLimit">
set(limitVar, 0);
</action>
<action name="clearHtml">
set(layer[showPolyPos].html, '');
</action>
<action name="visibleFalse">
set(hotspot[testspot].point[0].ath, ");
set(hotspot[testspot].point[0].atv, ");
set(hotspot[testspot].point[1].ath, ");
set(hotspot[testspot].point[1].atv, ");
set(hotspot[testspot].point[2].ath, ");
set(hotspot[testspot].point[2].atv, ");
set(hotspot[testspot].point[3].ath, ");
set(hotspot[testspot].point[3].atv, ");
set(hotspot[testspot].visible, false);
</action>
<events
οnclick="polyPosition();"
/>
<!--
_a_ == <
_b_ == >
c ==
-->
<action name="polygonal">
openurl(txt.html?codeString=_a_hotspot name=" style="hs_polygonal" moveidx=" galleryname=" οnclick="show_gallery(get(galleryname), get(moveidx));"_b_<br/>_a_point ath="%1" atv="%2" /_b_<br/>_a_point ath="%3" atv="%4" /_b_<br/>_a_point ath="%5" atv="%6" /_b_<br/>_a_point ath="%7" atv="%8" /_b_<br/>_a_/hotspot_b_ , "_blank");
initLimit();
clearHtml();
</action>
<action name="polyPosition">
inc(limitVar);
screentosphere(mouse.x, mouse.y, toh, tov);
if(limitVar EQ 1,
visibleFalse();
copy(myToh_1, toh);
copy(myTov_1, tov);
txtadd(layer[showPolyPos].html, calc(layer[showPolyPos].html+toh+', '+tov+'<br/>'));
set(hotspot[testspot].point[0].ath, get(toh));
set(hotspot[testspot].point[0].atv, get(tov));
);
if(limitVar EQ 2,
copy(myToh_2, toh);
copy(myTov_2, tov);
txtadd(layer[showPolyPos].html, calc(toh+', '+tov+'<br/>'));
set(hotspot[testspot].point[1].ath, get(toh));
set(hotspot[testspot].point[1].atv, get(tov));
);
if(limitVar EQ 3,
copy(myToh_3, toh);
copy(myTov_3, tov);
txtadd(layer[showPolyPos].html, calc(toh+', '+tov+'<br/>'));
set(hotspot[testspot].point[2].ath, get(toh));
set(hotspot[testspot].point[2].atv, get(tov));
);
if(limitVar EQ 4,
copy(myToh_4, toh);
copy(myTov_4, tov);
txtadd(layer[showPolyPos].html, calc(toh+', '+tov+'<br/>'));
set(hotspot[testspot].point[3].ath, get(toh));
set(hotspot[testspot].point[3].atv, get(tov));
set(hotspot[testspot].visible, true);
);
</action>
<action name="showPolyPosClick">
if(limitVar GE 4,
polygonal(get(myToh_1),get(myTov_1),get(myToh_2),get(myTov_2),get(myToh_3),get(myTov_3),get(myToh_4),get(myTov_4));
);
</action>
<layer name="showPolyPos" url="plugins/textfield.swf" html="" keep="true" onover="set(css, 'color:#ff0000');" onout="set(css, 'color:#000000');" οnclick="showPolyPosClick();" />
</krpano>
同様に、tour.xmlと同じディレクトリにtxt.htmlファイルを作成します。コードは次のとおりです。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CodePage</title>
</head>
<script type="text/javascript">
function LinkToString(LinkString){
var reg = new RegExp("(^|&)"+ LinkString +"=([^&]*)(&|$)");
var rString = window.location.search.substr(1).match(reg);
if(rString != null)
return unescape(rString[2]);
return null;
}
var string_1 = LinkToString("codeString");
var string_2 = string_1.replace(/_a_/g, "<");
var string_3 = string_2.replace(/_b_/g, ">");
document.write(string_3);
</script>
<body>
</body>
</html>