baidu-map-track-render-vue
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -143,75 +143,45 @@ /*! | ||
// | ||
var BMapPoints = []; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = points[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var point = _step2.value; | ||
BMapPoints.push(new BMap.Point(point.lng, point.lat)); | ||
} | ||
// | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
var BMapPoints = points.map(function (point) { | ||
return new BMap.Point(point.lng, point.lat); | ||
}); | ||
// | ||
var promises = []; | ||
var n = 100; | ||
var _loop = function _loop(i, j) { | ||
while (BMapPoints.length > 0) { | ||
promises.push(new Promise(function (resolve, reject) { | ||
var start = i * n; | ||
var end = start + n; | ||
convertor.translate(BMapPoints.slice(start, end), 1, 5, function (data) { | ||
convertor.translate(BMapPoints.splice(0, n), 1, 5, function (data) { | ||
resolve(data); | ||
}); | ||
})); | ||
}; | ||
for (var i = 0, j = 0; j < points.length; i++, j += n) { | ||
_loop(i, j); | ||
} | ||
return Promise.all(promises).then(function (datas) { | ||
var resultPoints = []; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator3 = datas[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var data = _step3.value; | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
for (var _iterator2 = datas[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var data = _step2.value; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator4 = data.points[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var _point = _step4.value; | ||
for (var _iterator3 = data.points[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var point = _step3.value; | ||
resultPoints.push(_point); | ||
resultPoints.push(point); | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
@@ -222,12 +192,12 @@ } | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
@@ -234,0 +204,0 @@ } |
@@ -141,75 +141,45 @@ /*! | ||
// | ||
var BMapPoints = []; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = points[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var point = _step2.value; | ||
BMapPoints.push(new BMap.Point(point.lng, point.lat)); | ||
} | ||
// | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
var BMapPoints = points.map(function (point) { | ||
return new BMap.Point(point.lng, point.lat); | ||
}); | ||
// | ||
var promises = []; | ||
var n = 100; | ||
var _loop = function _loop(i, j) { | ||
while (BMapPoints.length > 0) { | ||
promises.push(new Promise(function (resolve, reject) { | ||
var start = i * n; | ||
var end = start + n; | ||
convertor.translate(BMapPoints.slice(start, end), 1, 5, function (data) { | ||
convertor.translate(BMapPoints.splice(0, n), 1, 5, function (data) { | ||
resolve(data); | ||
}); | ||
})); | ||
}; | ||
for (var i = 0, j = 0; j < points.length; i++, j += n) { | ||
_loop(i, j); | ||
} | ||
return Promise.all(promises).then(function (datas) { | ||
var resultPoints = []; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator3 = datas[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var data = _step3.value; | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
for (var _iterator2 = datas[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var data = _step2.value; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator4 = data.points[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var _point = _step4.value; | ||
for (var _iterator3 = data.points[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var point = _step3.value; | ||
resultPoints.push(_point); | ||
resultPoints.push(point); | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
@@ -220,12 +190,12 @@ } | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
@@ -232,0 +202,0 @@ } |
@@ -147,75 +147,45 @@ /*! | ||
// | ||
var BMapPoints = []; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = points[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var point = _step2.value; | ||
BMapPoints.push(new BMap.Point(point.lng, point.lat)); | ||
} | ||
// | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
var BMapPoints = points.map(function (point) { | ||
return new BMap.Point(point.lng, point.lat); | ||
}); | ||
// | ||
var promises = []; | ||
var n = 100; | ||
var _loop = function _loop(i, j) { | ||
while (BMapPoints.length > 0) { | ||
promises.push(new Promise(function (resolve, reject) { | ||
var start = i * n; | ||
var end = start + n; | ||
convertor.translate(BMapPoints.slice(start, end), 1, 5, function (data) { | ||
convertor.translate(BMapPoints.splice(0, n), 1, 5, function (data) { | ||
resolve(data); | ||
}); | ||
})); | ||
}; | ||
for (var i = 0, j = 0; j < points.length; i++, j += n) { | ||
_loop(i, j); | ||
} | ||
return Promise.all(promises).then(function (datas) { | ||
var resultPoints = []; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator3 = datas[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var data = _step3.value; | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
for (var _iterator2 = datas[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var data = _step2.value; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator4 = data.points[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var _point = _step4.value; | ||
for (var _iterator3 = data.points[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var point = _step3.value; | ||
resultPoints.push(_point); | ||
resultPoints.push(point); | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
@@ -226,12 +196,12 @@ } | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
@@ -238,0 +208,0 @@ } |
@@ -8,3 +8,3 @@ /*! | ||
!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.lng,u.lat))}}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}})}}}}); | ||
!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){for(var e=new n.Convertor,r=t.map(function(t){return new n.Point(t.lng,t.lat)}),a=[];r.length>0;)a.push(new Promise(function(t,n){e.translate(r.splice(0,100),1,5,function(n){t(n)})}));return Promise.all(a).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.6", | ||
"version": "1.0.7", | ||
"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
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
35453
638