SafetyScreen-ui/public/static/map/modules/poly_r52vuo.js

1 line
19 KiB
JavaScript
Raw Normal View History

2024-11-06 09:03:49 +08:00
_jsload2&&_jsload2('poly', 'function tg(a,b){gb.call(this);this.point=a;this.type=b;this.z={}}z.lang.ta(tg,gb,"Vertex"); z.extend(tg.prototype,{initialize:function(a){this.map=a;var b="",b=this.type?"BMap_vectex BMap_vectex_nodeT":"BMap_vectex BMap_vectex_node",c=this.xH=this.V=document.createElement("div");c.className=b;a.Tf().nP.appendChild(c);this.HA();return c},draw:function(){var a=this.map.Xe(this.point);this.xH.style.left=a.x-5+"px";this.xH.style.top=a.y-5+"px"},sa:function(a){a instanceof J&&(this.point=this.z.point=new J(a.lng,a.lat),this.draw())},ga:w("point"),HA:function(){function a(a,b){b.pixel=b.lb=a.lb; b.point=b.point=a.point;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 Q(b,c)}if(this.V&&!this.V.Fi){this.V.Fi=q;var c=this.map,e=this,f=0,g=0,i=0,k={x:0,y:0};this.Hs=function(a){na(a);if(2!=a.button){e.sl=q;var k=c.$b(e.point),o=b(a);f=o.x-k.x;g=o.y-k.y;i=bb();e.map.R.iv=e;z.M(document,"mousemove",e.dj);z.M(document,"mouseup",e.cj);z.M(document,"touchmove",e.dj);z.M(document,"touchend",e.cj);e.V&&e.V.setCapture&& e.V.setCapture();e.V.style.cursor=e.z.Hd;"touchstart"==a.type&&ma(a)}};this.dj=function(i){if(e.sl){i=b(i);k=i=new Q(i.x-f,i.y-g);e.fA=i;var n=e.map.xb(i),o={lb:i,point:n};e.Fl=e.Gl=0;if(20>=i.x||i.x>=e.map.width-20||50>=i.y||i.y>=e.map.height-10){if(20>=i.x?e.Fl=8:i.x>=e.map.width-20&&(e.Fl=-8),50>=i.y?e.Gl=8:i.y>=e.map.height-10&&(e.Gl=-8),!e.Ge)e.Ge=setInterval(function(){c.Ag(e.Fl,e.Gl,{noAnimation:q});var a=c.xb(e.fA);e.sa(a)},30)}else e.Ge&&(clearInterval(e.Ge),e.Ge=s),e.sa(n);e.kl||(e.dispatchEvent(a(o, new P("ondragstart"))),e.kl=q);e.dispatchEvent(a(o,new P("ondragging")))}};this.cj=function(){e.V&&e.V.releaseCapture&&e.V.releaseCapture();e.sl=t;e.map.R.iv=s;z.ed(document,"mousemove",e.dj);z.ed(document,"mouseup",e.cj);z.ed(document,"touchmove",e.dj);z.ed(document,"touchend",e.cj);f=g=0;e.Ge&&(clearInterval(e.Ge),e.Ge=s);if(100<=bb()-i&&(2<k.x||2<k.y))e.kl=t,e.dispatchEvent(a({lb:e.map.$b(e.ga()),point:e.ga()},new P("ondragend"))),k.x=k.y=0;e.Ql();e.V&&(e.V.style.cursor=e.z.jf?"pointer":"")};z.M(this.V, "mousedown",this.Hs);z.M(this.V,"touchstart",this.Hs)}}});z.extend(sc.prototype,{HQ:function(a){return this.repeat?this.JQ(a):this.IQ(a)},JQ:function(a){var b=this.repeat,c=[],e,f,g;if(this.XI){e=Math.floor(1/this.repeat)+1;for(f=0;f<e;f++)c.push(ug(a,1-b*f,q))}else{g=a.Qi[a.Qi.length-1];e=Math.floor(g/b)+1;for(f=0;f<e;f++)c.push(ug(a,g-f*b,t))}return c},IQ:function(a){return[ug(a,this.Zj,this.WI)]},hide:function(){if(this.Vc&&0<this.Vc.length)for(var a=this.Vc.length-1;0<=a;a--)this.Vc[a].U()},show:function(){if(this.Vc&&0<this.Vc.length)for(var a=this.Vc.length- 1;0<=a;a--)this.Vc[a].show()}});function ug(a,b,c){var e=a.ja;if(c){if(0>=b)return{point:e[0],index:1};if(1<=b)return{point:e[e.length-1],index:e.length-1};c=a.kT*b;b=vg(c,a.Kl);a=(c-a.Kl[b-1])/(a.Kl[b]-a.Kl[b-1])}else{c=b;b=a.Qi[a.Qi.length-1];if(0>=c)return{point:e[0],index:1};if(c>=b)return{point:e[e.length-1],index:e.length-1};b=vg(c,a.Qi);a=(c-a.Qi[b-1])/(a.Qi[b]-a.Qi[b-1])}c=e[b-1];e=e[b];return{point:new J(c.lng+(e.lng-c.lng)*a,c.lat+(e.lat-c.lat)*a),index:b}} z.mc.indexOf=function(a,b,c){var e=a.length,c=c|0;for(0>c&&(c=Math.max(0,e+c));c<e;c++)if(c in a&&a[c]===b)return c;return-1};function vg(a,b){var c=wg(b.concat(a));return z.mc.indexOf(c,a)}function wg(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=wg(c),a=wg(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)};z.extend(oc.prototype,{initialize:function(a){a&&this.vv&&a.addEventListener("onmousemove",this.vv);a=gb.prototype.initialize.call(this,a);this.z.mf===q&&(this.nk(),this.Ul());return a},Ej:function(){this.V=(this.Tn=xg.Ws(this.map)).Ao()},ba:function(){function a(a,b){var c=a.srcElement||a.target,i=Eb(),k=a.pageX?a.pageX:a.clientX+i[1],i=a.pageY?a.pageY:a.clientY+i[0];if(a&&b&&k&&i&&c){var c=z.lang.Nc(c.aa).map,m=z.D.ga(c.Wa);b.lb=new Q(k-m.left,i-m.top);b.point=c.xb(b.l