krpano拖拽图层和热点
首页 > 随笔    作者:lininn   2017年9月19日 22:36 星期二   热度:2785°   百度已收录  
时间:2017-9-19 22:36   热度:2785° 

拖拽热点:


<action name="draghotspot">
	spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery, 'l');
	sub(drag_adjustx, mouse.stagex, hotspotcenterx);
	sub(drag_adjusty, mouse.stagey, hotspotcentery);
	asyncloop(pressed,
		sub(dx, mouse.stagex, drag_adjustx);
		sub(dy, mouse.stagey, drag_adjusty);
		screentosphere(dx, dy, ath, atv);
	  );
</action>
调用:
ondown="draghotspot();"
拖拽图层:
创建图层:
<layer name="box1" type="container" align="lefttop" x="10" y="10" width="250" height="250" bgcolor="0x000000" bgalpha="0.5" bgcapture="true" maskchildren="true" ondown="draglayer();">
	<layer name="box2" type="container" align="center" x="0" y="0" width="100" height="100" bgcolor="0x44AADD" bgalpha="1.0" bgcapture="true" ondown="draglayer();" />
</layer>
方法:
<action name="draglayer">
	copy(drag_currentx, x);
	copy(drag_currenty, y);
	copy(drag_stagex, mouse.stagex);
	copy(drag_stagey, mouse.stagey);
	indexoftxt(align_contains_right, get(align), 'right');
	indexoftxt(align_contains_bottom, get(align), 'bottom');
	calc(drag_align_x, align_contains_right GE 0 ? -1 : +1);
	calc(drag_align_y, align_contains_bottom GE 0 ? -1 : +1);
	asyncloop(pressed,
		calc(x, drag_currentx + (mouse.stagex - drag_stagex)*drag_align_x);
		calc(y, drag_currenty + (mouse.stagey - drag_stagey)*drag_align_y);
	  );
</action>


二维码加载中...
本文作者:lininn      文章标题: krpano拖拽图层和热点
本文地址:?post=30
版权声明:若无注明,本文皆为“覆手为雨”原创,转载请保留文章出处。
分享本文至:

返回顶部    首页    手机版本    后花园   会员注册   
版权所有:覆手为雨    站长: lininn