2 lines
19 KiB
JavaScript
2 lines
19 KiB
JavaScript
|
|
/**/_jsload2&&_jsload2('poly', 'function gh(a,b){ib.call(this);this.point=a;this.type=b;this.z={}}x.lang.ua(gh,ib,"Vertex"); x.extend(gh.prototype,{initialize:function(a){this.map=a;var b="";this.point=Za(this.point,this.map);var b=this.type?"BMap_vectex BMap_vectex_nodeT":"BMap_vectex BMap_vectex_node",c=this.BH=this.V=document.createElement("div");c.className=b;a.Rf().nP.appendChild(c);this.OA();return c},draw:function(){var a=this.map.We(this.point);this.BH.style.left=a.x-5+"px";this.BH.style.top=a.y-5+"px"},ta:function(a){if(a instanceof O||a instanceof K)this.point=this.z.point=Za(a,this.map),this.draw()},eo:v("point"), ia:function(){return fb(this.point,this.map)},OA:function(){function a(a,b){b.pixel=b.Wa=a.Wa;b.point=b.point=a.point;b.pointN=b.Bg=a.Bg;return b}function b(a){var b=a.clientX,c=a.clientY;a.changedTouches&&(b=a.changedTouches[0].clientX,c=a.changedTouches[0].clientY);return new R(b,c)}if(this.V&&!this.V.Pi){this.V.Pi=o;var c=this.map,d=this,e=0,f=0,g=0,i={x:0,y:0};this.Ns=function(a){oa(a);if(2!=a.button){d.vl=o;var i=c.Cc(d.point),m=b(a);e=m.x-i.x;f=m.y-i.y;g=cb();d.map.R.nv=d;x.M(document,"mousemove", d.mj);x.M(document,"mouseup",d.lj);x.M(document,"touchmove",d.mj);x.M(document,"touchend",d.lj);d.V&&d.V.setCapture&&d.V.setCapture();d.V.style.cursor=d.z.Id;"touchstart"==a.type&&na(a)}};this.mj=function(g){if(d.vl){g=b(g);i=g=new R(g.x-e,g.y-f);d.nA=g;var l=d.map.Ag(g),m=d.map.Rb(g),m={Wa:g,point:l,Bg:m};d.Jl=d.Kl=0;if(20>=g.x||g.x>=d.map.width-20||50>=g.y||g.y>=d.map.height-10){if(20>=g.x?d.Jl=8:g.x>=d.map.width-20&&(d.Jl=-8),50>=g.y?d.Kl=8:g.y>=d.map.height-10&&(d.Kl=-8),!d.He)d.He=setInterval(function(){c.zg(d.Jl, d.Kl,{noAnimation:o});var a=c.Rb(d.nA);d.ta(a)},30)}else d.He&&(clearInterval(d.He),d.He=p),d.ta(l);d.nl||(d.dispatchEvent(a(m,new N("ondragstart"))),d.nl=o);d.dispatchEvent(a(m,new N("ondragging")))}};this.lj=function(){d.V&&d.V.releaseCapture&&d.V.releaseCapture();d.vl=q;d.map.R.nv=p;x.cd(document,"mousemove",d.mj);x.cd(document,"mouseup",d.lj);x.cd(document,"touchmove",d.mj);x.cd(document,"touchend",d.lj);e=f=0;d.He&&(clearInterval(d.He),d.He=p);if(100<=cb()-g&&(2<i.x||2<i.y))d.nl=q,d.dispatchEvent(a({Wa:d.map.Mp(d.ia()), point:d.ia(),Bg:d.eo()},new N("ondragend"))),i.x=i.y=0;d.Wl();d.V&&(d.V.style.cursor=d.z.jf?"pointer":"")};x.M(this.V,"mousedown",this.Ns);x.M(this.V,"touchstart",this.Ns)}}});x.extend(ld.prototype,{IQ:function(a){return this.repeat?this.KQ(a):this.JQ(a)},KQ:function(a){var b=this.repeat,c=[],d,e,f;if(this.bJ){d=Math.floor(1/this.repeat)+1;for(e=0;e<d;e++)c.push(hh(a,1-b*e,o))}else{f=a.$i[a.$i.length-1];d=Math.floor(f/b)+1;for(e=0;e<d;e++)c.push(hh(a,f-e*b,q))}return c},JQ:function(a){return[hh(a,this.gk,this.aJ)]},hide:function(){if(this.jd&&0<this.jd.length)for(var a=this.jd.length-1;0<=a;a--)this.jd[a].U()},show:function(){if(this.jd&&0<this.jd.length)for(var a=this.jd.length- 1;0<=a;a--)this.jd[a].show()}});function hh(a,b,c){var d=a.ha;if(c){if(0>=b)return{point:d[0],index:1};if(1<=b)return{point:d[d.length-1],index:d.length-1};c=a.kT*b;b=ih(c,a.Ql);a=(c-a.Ql[b-1])/(a.Ql[b]-a.Ql[b-1])}else{c=b;b=a.$i[a.$i.length-1];if(0>=c)return{point:d[0],index:1};if(c>=b)return{point:d[d.length-1],index:d.length-1};b=ih(c,a.$i);a=(c-a.$i[b-1])/(a.$i[b]-a.$i[b-1])}c=d[b-1];d=d[b];return{point:new K(c.lng+(d.lng-c.lng)*a,c.lat+(d.lat-c.lat)*a),index:b}} x.jc.indexOf=function(a,b,c){var d=a.length,c=c|0;for(0>c&&(c=Math.max(0,d+c));c<d;c++)if(c in a&&a[c]===b)return c;return-1};function ih(a,b){var c=jh(b.concat(a));return x.jc.indexOf(c,a)}function jh(a){if(2>a.length)return a;for(var b=Math.floor(a.length/2),c=a.slice(0,b),a=a.slice(b),c=jh(c),a=jh(a),b=[];0<c.length&&0<a.length;)c[0]>a[0]?b.push(a.shift()):b.push(c.shift());return b.concat(c).concat(a)};x.extend(hd.prototype,{initialize:function(a){a&&this.xv&&a.addEventListener("onmousemove",this.xv);a=ib.prototype.initialize.call(this,a);this.z.mf===o&&(this.tk(),this.am());return a},Oj:function(){this.V=(this.$n=kh.bt(this.map)).Ho()},ca:function(){function a(a,b){var c=a.srcElement||a.target,g=Fb(),i=a.pageX?a.pageX:a.c
|