From f4b4ace227b35ef357db0a8545629588419d344a Mon Sep 17 00:00:00 2001 From: 81041 <81041@192.168.10.8> Date: 星期一, 29 十月 2018 16:50:04 +0800 Subject: [PATCH] Merge branch 'dev_lxw' of https://whyclxw1@gitlab.com/whyclxw1/gx_tieta.git into dev_lxw --- gx_tieta/WebRoot/js/AreaRestriction_min.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 55 insertions(+), 1 deletions(-) diff --git a/gx_tieta/WebRoot/js/AreaRestriction_min.js b/gx_tieta/WebRoot/js/AreaRestriction_min.js index d477323..ec87afd 100644 --- a/gx_tieta/WebRoot/js/AreaRestriction_min.js +++ b/gx_tieta/WebRoot/js/AreaRestriction_min.js @@ -1 +1,55 @@ -var BMapLib=window.BMapLib=BMapLib||{};(function(){var b=BMapLib.AreaRestriction=function(){};var a=false;var c=null;var d=null;b.setBounds=function(f,e){if(!f||!e||!(e instanceof BMap.Bounds)){throw"\u8bf7\u68c0\u67e5\u4f20\u5165\u53c2\u6570\u503c\u7684\u5408\u6cd5\u6027";return false}if(a){this.clearBounds()}c=f;d=e;c.addEventListener("moveend",this._mapMoveendEvent);a=true;return true};b._mapMoveendEvent=function(k){if(d.containsBounds(c.getBounds())){return}var i=c.getBounds(),h=i.getSouthWest(),g=i.getNorthEast(),m=d.getSouthWest(),j=d.getNorthEast();var l={n:0,e:0,s:0,w:0};l.n=(g.lat<j.lat)?g.lat:j.lat;l.e=(g.lng<j.lng)?g.lng:j.lng;l.s=(h.lat<m.lat)?m.lat:h.lat;l.w=(h.lng<m.lng)?m.lng:h.lng;var f=new BMap.Point(l.w+(l.e-l.w)/2,l.s+(l.n-l.s)/2);setTimeout(function(){c.panTo(f,{noAnimation:"no"})},1)};b.clearBounds=function(){if(!a){return}c.removeEventListener("moveend",this._mapMoveendEvent);a=false}})(); \ No newline at end of file +var BMapLib = window.BMapLib = BMapLib || {}; +(function() { + var b = BMapLib.AreaRestriction = function() {}; + var a = false; + var c = null; + var d = null; + b.setBounds = function(f, e) { + if (!f || !e || !(e instanceof BMap.Bounds)) { + throw "璇锋鏌ヤ紶鍏ュ弬鏁板�肩殑鍚堟硶鎬�"; + return false; + } + if (a) { + this.clearBounds(); + } + c = f; + d = e; + c.addEventListener("moveend", this._mapMoveendEvent); + a = true; + return true; + }; + b._mapMoveendEvent = function(k) { + if (d.containsBounds(c.getBounds())) { + return + } + console.log(c.getBounds()); + var i = c.getBounds(), + h = i.getSouthWest(), + g = i.getNorthEast(), + m = d.getSouthWest(), + j = d.getNorthEast(); + var l = { + n: 0, + e: 0, + s: 0, + w: 0 + }; + l.n = (g.lat < j.lat) ? g.lat : j.lat; + l.e = (g.lng < j.lng) ? g.lng : j.lng; + l.s = (h.lat < m.lat) ? m.lat : h.lat; + l.w = (h.lng < m.lng) ? m.lng : h.lng; + var f = new BMap.Point(l.w + (l.e - l.w) / 2, l.s + (l.n - l.s) / 2); + setTimeout(function() { + c.panTo(f, { + noAnimation: "no" + }); + }, 1); + }; + b.clearBounds = function() { + if (!a) { + return + } + c.removeEventListener("moveend", this._mapMoveendEvent); + a = false; + }; +})(); \ No newline at end of file -- Gitblit v1.9.1