baidu-map-track-render-vue
Advanced tools
Comparing version 1.0.3 to 1.0.4
/*! | ||
* baidu-map-track-render-vue v1.0.0 | ||
* baidu-map-track-render-vue v1.0.3 | ||
* phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -97,25 +97,2 @@ * https://github.com/phphe/baidu-map-track-render-vue.git | ||
methods: { | ||
mapReady: function mapReady(BMap) { | ||
var _this2 = this; | ||
if (this.points) { | ||
this.convertPoints(this.points, BMap).then(function (_ref2) { | ||
var points = _ref2.points; | ||
var map = new BMap.Map('map'); | ||
var center = _this2.getCenter(points, BMap); | ||
map.centerAndZoom(center, 15); | ||
map.enableScrollWheelZoom(); | ||
for (var i = 0; i < points.length; i++) { | ||
var prev = points[i - 1]; | ||
if (prev) { | ||
var current = points[i]; | ||
var polyline = new BMap.Polyline([prev, current], { strokeColor: 'blue', strokeWeight: 2, strokeOpacity: 0.5 }); // 创建折线 | ||
map.addOverlay(polyline); // 增加折线 | ||
} | ||
} | ||
}); | ||
} | ||
}, | ||
getCenter: function getCenter(points, BMap) { | ||
@@ -122,0 +99,0 @@ var maxX = points[0].lng; |
/*! | ||
* baidu-map-track-render-vue v1.0.0 | ||
* baidu-map-track-render-vue v1.0.3 | ||
* phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -95,25 +95,2 @@ * https://github.com/phphe/baidu-map-track-render-vue.git | ||
methods: { | ||
mapReady: function mapReady(BMap) { | ||
var _this2 = this; | ||
if (this.points) { | ||
this.convertPoints(this.points, BMap).then(function (_ref2) { | ||
var points = _ref2.points; | ||
var map = new BMap.Map('map'); | ||
var center = _this2.getCenter(points, BMap); | ||
map.centerAndZoom(center, 15); | ||
map.enableScrollWheelZoom(); | ||
for (var i = 0; i < points.length; i++) { | ||
var prev = points[i - 1]; | ||
if (prev) { | ||
var current = points[i]; | ||
var polyline = new BMap.Polyline([prev, current], { strokeColor: 'blue', strokeWeight: 2, strokeOpacity: 0.5 }); // 创建折线 | ||
map.addOverlay(polyline); // 增加折线 | ||
} | ||
} | ||
}); | ||
} | ||
}, | ||
getCenter: function getCenter(points, BMap) { | ||
@@ -120,0 +97,0 @@ var maxX = points[0].lng; |
/*! | ||
* baidu-map-track-render-vue v1.0.0 | ||
* baidu-map-track-render-vue v1.0.3 | ||
* phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -101,25 +101,2 @@ * https://github.com/phphe/baidu-map-track-render-vue.git | ||
methods: { | ||
mapReady: function mapReady(BMap) { | ||
var _this2 = this; | ||
if (this.points) { | ||
this.convertPoints(this.points, BMap).then(function (_ref2) { | ||
var points = _ref2.points; | ||
var map = new BMap.Map('map'); | ||
var center = _this2.getCenter(points, BMap); | ||
map.centerAndZoom(center, 15); | ||
map.enableScrollWheelZoom(); | ||
for (var i = 0; i < points.length; i++) { | ||
var prev = points[i - 1]; | ||
if (prev) { | ||
var current = points[i]; | ||
var polyline = new BMap.Polyline([prev, current], { strokeColor: 'blue', strokeWeight: 2, strokeOpacity: 0.5 }); // 创建折线 | ||
map.addOverlay(polyline); // 增加折线 | ||
} | ||
} | ||
}); | ||
} | ||
}, | ||
getCenter: function getCenter(points, BMap) { | ||
@@ -126,0 +103,0 @@ var maxX = points[0].lng; |
/*! | ||
* baidu-map-track-render-vue v1.0.0 | ||
* baidu-map-track-render-vue v1.0.3 | ||
* phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -8,3 +8,3 @@ * https://github.com/phphe/baidu-map-track-render-vue.git | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.BaiduMapTrackRender=e()}(this,function(){"use strict";function t(){return new Promise(function(t,e){document&&"complete"===document.readyState?t():window.addEventListener("load",function e(){t(),window.removeEventListener("load",e)})})}function e(t,e){t[e]=void 0;try{delete t[e]}catch(t){}}function n(r){var o=n;return t().then(function(){if(o.loaded)return window.BMap;if(!o.requested){o.requested=!0,window._BaiduMapLoadedCallback=function(){o.loaded=!0,e(window,"_BaiduMapLoadedCallback")};var t=document.createElement("script");return t.src="http://api.map.baidu.com/api?v=2.0&ak="+r+"&callback=_BaiduMapLoadedCallback",document.body.appendChild(t),new Promise(function(t,e){var n=window.setInterval(function(){o.loaded&&(window.clearInterval(n),t(window.BMap))},10)})}})}return{render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"baidu-map-track-render-vue"},[n("div",{staticClass:"baidu-map-track-render-vue__map",attrs:{id:t.id}})])},staticRenderFns:[],props:{points:{},ak:{}},data:function(){return{id:"BaiduMap_"+this._uid}},mounted:function(){var t=this;this.$nextTick(function(){n(t.ak).then(function(e){t.points&&t.convertPoints(t.points,e).then(function(n){var r=n.points,o=new e.Map(t.id),a=t.getCenter(r,e);o.centerAndZoom(a,15),o.enableScrollWheelZoom();for(var i=0;i<r.length;i++){var l=r[i-1];if(l){var d=r[i],u=new e.Polyline([l,d],{strokeColor:"blue",strokeWeight:2,strokeOpacity:.5});o.addOverlay(u)}}})})})},methods:{mapReady:function(t){var e=this;this.points&&this.convertPoints(this.points,t).then(function(n){var r=n.points,o=new t.Map("map"),a=e.getCenter(r,t);o.centerAndZoom(a,15),o.enableScrollWheelZoom();for(var i=0;i<r.length;i++){var l=r[i-1];if(l){var d=r[i],u=new t.Polyline([l,d],{strokeColor:"blue",strokeWeight:2,strokeOpacity:.5});o.addOverlay(u)}}})},getCenter:function(t,e){var n=t[0].lng,r=t[0].lat,o=t[0].lng,a=t[0].lat,i=!0,l=!1,d=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var s=u.value;s.lng<o&&(o=s.lng),s.lng>n&&(n=s.lng),s.lat<a&&(a=s.lat),s.lat>r&&(r=s.lat)}}catch(t){l=!0,d=t}finally{try{!i&&c.return&&c.return()}finally{if(l)throw d}}return new e.Point((n+o)/2,(r+a)/2)},convertPoints:function(t,e){var n=new e.Convertor,r=[],o=!0,a=!1,i=void 0;try{for(var l,d=t[Symbol.iterator]();!(o=(l=d.next()).done);o=!0){var u=l.value;r.push(new e.Point(u[0],u[1]))}}catch(t){a=!0,i=t}finally{try{!o&&d.return&&d.return()}finally{if(a)throw i}}for(var c=[],s=0,f=0;f<t.length;s++,f+=100)!function(t,e){c.push(new Promise(function(e,o){var a=100*t,i=a+100;n.translate(r.slice(a,i),1,5,function(t){e(t)})}))}(s);return Promise.all(c).then(function(t){var e=[],n=!0,r=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var l=a.value,d=!0,u=!1,c=void 0;try{for(var s,f=l.points[Symbol.iterator]();!(d=(s=f.next()).done);d=!0){var v=s.value;e.push(v)}}catch(t){u=!0,c=t}finally{try{!d&&f.return&&f.return()}finally{if(u)throw c}}}}catch(t){r=!0,o=t}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}return{points:e,dataArr:t}})}}}}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.BaiduMapTrackRender=n()}(this,function(){"use strict";function t(){return new Promise(function(t,n){document&&"complete"===document.readyState?t():window.addEventListener("load",function n(){t(),window.removeEventListener("load",n)})})}function n(t,n){t[n]=void 0;try{delete t[n]}catch(t){}}function e(r){var a=e;return t().then(function(){if(a.loaded)return window.BMap;if(!a.requested){a.requested=!0,window._BaiduMapLoadedCallback=function(){a.loaded=!0,n(window,"_BaiduMapLoadedCallback")};var t=document.createElement("script");return t.src="http://api.map.baidu.com/api?v=2.0&ak="+r+"&callback=_BaiduMapLoadedCallback",document.body.appendChild(t),new Promise(function(t,n){var e=window.setInterval(function(){a.loaded&&(window.clearInterval(e),t(window.BMap))},10)})}})}return{render:function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{staticClass:"baidu-map-track-render-vue"},[e("div",{staticClass:"baidu-map-track-render-vue__map",attrs:{id:t.id}})])},staticRenderFns:[],props:{points:{},ak:{}},data:function(){return{id:"BaiduMap_"+this._uid}},mounted:function(){var t=this;this.$nextTick(function(){e(t.ak).then(function(n){t.points&&t.convertPoints(t.points,n).then(function(e){var r=e.points,a=new n.Map(t.id),o=t.getCenter(r,n);a.centerAndZoom(o,15),a.enableScrollWheelZoom();for(var i=0;i<r.length;i++){var d=r[i-1];if(d){var l=r[i],u=new n.Polyline([d,l],{strokeColor:"blue",strokeWeight:2,strokeOpacity:.5});a.addOverlay(u)}}})})})},methods:{getCenter:function(t,n){var e=t[0].lng,r=t[0].lat,a=t[0].lng,o=t[0].lat,i=!0,d=!1,l=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var f=u.value;f.lng<a&&(a=f.lng),f.lng>e&&(e=f.lng),f.lat<o&&(o=f.lat),f.lat>r&&(r=f.lat)}}catch(t){d=!0,l=t}finally{try{!i&&c.return&&c.return()}finally{if(d)throw l}}return new n.Point((e+a)/2,(r+o)/2)},convertPoints:function(t,n){var e=new n.Convertor,r=[],a=!0,o=!1,i=void 0;try{for(var d,l=t[Symbol.iterator]();!(a=(d=l.next()).done);a=!0){var u=d.value;r.push(new n.Point(u[0],u[1]))}}catch(t){o=!0,i=t}finally{try{!a&&l.return&&l.return()}finally{if(o)throw i}}for(var c=[],f=0,s=0;s<t.length;f++,s+=100)!function(t,n){c.push(new Promise(function(n,a){var o=100*t,i=o+100;e.translate(r.slice(o,i),1,5,function(t){n(t)})}))}(f);return Promise.all(c).then(function(t){var n=[],e=!0,r=!1,a=void 0;try{for(var o,i=t[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var d=o.value,l=!0,u=!1,c=void 0;try{for(var f,s=d.points[Symbol.iterator]();!(l=(f=s.next()).done);l=!0){var v=f.value;n.push(v)}}catch(t){u=!0,c=t}finally{try{!l&&s.return&&s.return()}finally{if(u)throw c}}}}catch(t){r=!0,a=t}finally{try{!e&&i.return&&i.return()}finally{if(r)throw a}}return{points:n,dataArr:t}})}}}}); | ||
//# sourceMappingURL=BaiduMapTrackRender.min.js.map |
{ | ||
"name": "baidu-map-track-render-vue", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/BaiduMapTrackRender.common.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38698
712