krpano 热点热区多点图片鼠标快速定位polygonal插件

在与tour.xml同级目录下创建polyPosition.xml文件。

然后直接把polyPosition.xml插件引入tour.xml文件即可。

即在tour.xml中<krpano>标签的第二行写入<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>
 

部分内容转载自:软盟网

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值