diff --git a/dist/echarts-extension-gmap.js b/dist/echarts-extension-gmap.js index 689944f..8f20fb9 100644 --- a/dist/echarts-extension-gmap.js +++ b/dist/echarts-extension-gmap.js @@ -125,7 +125,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th /*! exports provided: name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, dependencies, default */ /***/ (function(module) { -eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"echarts-extension-gmap\\\",\\\"version\\\":\\\"1.0.3\\\",\\\"description\\\":\\\"An Google Map(https://www.google.com/maps) extension for ECharts(https://github.com/apache/incubator-echarts)\\\",\\\"main\\\":\\\"dist/echarts-extension-gmap.min.js\\\",\\\"scripts\\\":{\\\"build\\\":\\\"webpack -p\\\",\\\"dev\\\":\\\"webpack -d\\\",\\\"watch\\\":\\\"webpack -d --watch\\\",\\\"test\\\":\\\"echo \\\\\\\"Error: no test specified\\\\\\\" && exit 1\\\"},\\\"repository\\\":{\\\"type\\\":\\\"git\\\",\\\"url\\\":\\\"git+https://github.com/plainheart/echarts-extension-gmap.git\\\"},\\\"keywords\\\":[\\\"echarts\\\",\\\"google-maps\\\",\\\"google\\\",\\\"echarts-extention\\\",\\\"data-visualization\\\",\\\"map\\\",\\\"echarts-gmap\\\",\\\"echarts-google-map\\\",\\\"echarts4\\\",\\\"gmap\\\"],\\\"author\\\":\\\"plainheart\\\",\\\"license\\\":\\\"MIT\\\",\\\"bugs\\\":{\\\"url\\\":\\\"https://github.com/plainheart/echarts-extension-gmap/issues\\\"},\\\"homepage\\\":\\\"https://github.com/plainheart/echarts-extension-gmap#readme\\\",\\\"devDependencies\\\":{\\\"webpack\\\":\\\"^4.29.5\\\",\\\"webpack-cli\\\":\\\"^3.2.3\\\"},\\\"dependencies\\\":{\\\"echarts\\\":\\\"^4.7.0\\\",\\\"lodash.debounce\\\":\\\"^4.0.8\\\"}}\");//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9wYWNrYWdlLmpzb24uanMiLCJzb3VyY2VzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./package.json\n"); +eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"echarts-extension-gmap\\\",\\\"version\\\":\\\"1.0.4\\\",\\\"description\\\":\\\"An Google Map(https://www.google.com/maps) extension for ECharts(https://github.com/apache/incubator-echarts)\\\",\\\"main\\\":\\\"dist/echarts-extension-gmap.min.js\\\",\\\"scripts\\\":{\\\"build\\\":\\\"webpack -p\\\",\\\"dev\\\":\\\"webpack -d\\\",\\\"watch\\\":\\\"webpack -d --watch\\\",\\\"test\\\":\\\"echo \\\\\\\"Error: no test specified\\\\\\\" && exit 1\\\"},\\\"repository\\\":{\\\"type\\\":\\\"git\\\",\\\"url\\\":\\\"git+https://github.com/plainheart/echarts-extension-gmap.git\\\"},\\\"keywords\\\":[\\\"echarts\\\",\\\"google-maps\\\",\\\"google\\\",\\\"echarts-extention\\\",\\\"data-visualization\\\",\\\"map\\\",\\\"echarts-gmap\\\",\\\"echarts-google-map\\\",\\\"echarts4\\\",\\\"gmap\\\"],\\\"author\\\":\\\"plainheart\\\",\\\"license\\\":\\\"MIT\\\",\\\"bugs\\\":{\\\"url\\\":\\\"https://github.com/plainheart/echarts-extension-gmap/issues\\\"},\\\"homepage\\\":\\\"https://github.com/plainheart/echarts-extension-gmap#readme\\\",\\\"devDependencies\\\":{\\\"webpack\\\":\\\"^4.29.5\\\",\\\"webpack-cli\\\":\\\"^3.2.3\\\"},\\\"dependencies\\\":{\\\"echarts\\\":\\\"^4.7.0\\\",\\\"lodash.debounce\\\":\\\"^4.0.8\\\"}}\");//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9wYWNrYWdlLmpzb24uanMiLCJzb3VyY2VzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./package.json\n"); /***/ }), diff --git a/dist/echarts-extension-gmap.min.js b/dist/echarts-extension-gmap.min.js index 8991bea..5a65acd 100644 --- a/dist/echarts-extension-gmap.min.js +++ b/dist/echarts-extension-gmap.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],t):"object"==typeof exports?exports.gmap=t(require("echarts")):e.gmap=t(e.echarts)}(window,(function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(t,n){t.exports=e},function(e){e.exports=JSON.parse('{"a":"echarts-extension-gmap","b":"1.0.3"}')},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,u=s||c||Function("return this")(),p=Object.prototype.toString,l=Math.max,f=Math.min,g=function(){return u.Date.now()};function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function m(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==p.call(e)}(e))return NaN;if(d(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=d(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var s=r.test(e);return s||i.test(e)?a(e.slice(2),s?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var o,r,i,a,s,c,u=0,p=!1,h=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=o,i=r;return o=r=void 0,u=t,a=e.apply(i,n)}function _(e){return u=e,s=setTimeout(b,t),p?v(e):a}function x(e){var n=e-c;return void 0===c||n>=t||n<0||h&&e-u>=i}function b(){var e=g();if(x(e))return w(e);s=setTimeout(b,function(e){var n=t-(e-c);return h?f(n,i-(e-u)):n}(e))}function w(e){return s=void 0,y&&o?v(e):(o=r=void 0,a)}function O(){var e=g(),n=x(e);if(o=arguments,r=this,c=e,n){if(void 0===s)return _(c);if(h)return s=setTimeout(b,t),v(c)}return void 0===s&&(s=setTimeout(b,t)),a}return t=m(t)||0,d(n)&&(p=!!n.leading,i=(h="maxWait"in n)?l(m(n.maxWait)||0,t):i,y="trailing"in n?!!n.trailing:y),O.cancel=function(){void 0!==s&&clearTimeout(s),u=0,o=c=r=s=void 0},O.flush=function(){return void 0===s?a:w(g())},O}}).call(this,n(3))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"version",(function(){return o.b})),n.d(t,"name",(function(){return o.a}));var o=n(1),r=n(0);function i(e,t){this._gmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}var a,s=i.prototype,c=["echartsLayerZIndex","renderOnMoving"];function u(e,t){return t=t||[0,0],r.util.map([0,1],(function(n){var o=t[n],r=e[n]/2,i=[],a=[];return i[n]=o-r,a[n]=o+r,i[1-n]=a[1-n]=t[1-n],Math.abs(this.dataToPoint(i)[n]-this.dataToPoint(a)[n])}),this)}function p(e,t){var n=t.__overlayProjection;if(n)return n.fromLatLngToContainerPixel(e)}s.dimensions=["lng","lat"],s.setZoom=function(e){this._zoom=e},s.setCenter=function(e){var t=new google.maps.LatLng(e[1],e[0]);this._center=p(t,this._gmap)},s.setMapOffset=function(e){this._mapOffset=e},s.setGoogleMap=function(e){this._gmap=e},s.getGoogleMap=function(){return this._gmap},s.dataToPoint=function(e){var t=p(new google.maps.LatLng(e[1],e[0]),this._gmap);if(t){var n=this._mapOffset;return[t.x-n[0],t.y-n[1]]}},s.pointToData=function(e){var t=this._mapOffset,n=function(e,t){var n=t.__overlayProjection;if(!n)return;return n.fromContainerPixelToLatLng(e)}(new google.maps.Point(e[0]+t[0],e[1]+t[1]),this._gmap);return[n.lng(),n.lat()]},s.getViewRect=function(){var e=this._api;return new r.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},s.getRoamTransform=function(){return r.matrix.create()},s.prepareCustoms=function(e){var t=this.getViewRect();return{coordSys:{type:"gmap",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:r.util.bind(this.dataToPoint,this),size:r.util.bind(u,this)}}},i.dimensions=s.dimensions,i.create=function(e,t){var n,o=t.getDom();e.eachComponent("gmap",(function(e){var s=t.getZr().painter,u=s.getViewportRoot();if("undefined"==typeof google||void 0===google.maps||void 0===google.maps.Map)throw new Error("It seems that Google Map API has not been loaded completely yet.");if(a=a||function(){function e(e,t){this._root=e,this.setMap(t)}return e.prototype=new google.maps.OverlayView,e.prototype.onAdd=function(){var e=this.getMap();e.__overlayProjection=this.getProjection(),e.getDiv().querySelector(".gm-style > div").appendChild(this._root)},e.prototype.draw=function(){google.maps.event.trigger(this.getMap(),"gmaprender")},e.prototype.onRemove=function(){this._root.parentNode.removeChild(this._root),this._root=null},e.prototype.setZIndex=function(e){this._root.style.zIndex=e},e.prototype.getZIndex=function(){return this._root.style.zIndex},e}(),n)throw new Error("Only one google map component can exist");var p=e.getGoogleMap();if(!p){var l=o.querySelector(".ec-extension-google-map");l&&(u.style.left="0px",u.style.top="0px",u.style.width="100%",u.style.height="100%",o.removeChild(l)),(l=document.createElement("div")).style.cssText="width:100%;height:100%",l.classList.add("ec-extension-google-map"),o.appendChild(l);var f=r.util.clone(e.get()),g=f.echartsLayerZIndex;r.util.each(c,(function(e){delete f[e]}));var d=f.center;r.util.isArray(d)&&(f.center={lng:d[0],lat:d[1]}),p=new google.maps.Map(l,f),e.setGoogleMap(p),e.__projectionChangeListener&&e.__projectionChangeListener.remove(),e.__projectionChangeListener=google.maps.event.addListener(p,"projection_changed",(function(){var t=e.getEChartsLayer();t&&t.setMap(null);var n=new a(u,p);n.setZIndex(g),e.setEChartsLayer(n)})),s.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var m=[null!=(d=e.get("center")).lng?d.lng:d[0],null!=d.lat?d.lat:d[1]],h=e.get("zoom");if(d&&h){var y=p.getCenter(),v=p.getZoom();if(e.centerOrZoomChanged([y.lng(),y.lat()],v)){var _=new google.maps.LatLng(m[1],m[0]);p.setOptions({center:_,zoom:h})}}(n=new i(p,t)).setMapOffset(e.__mapOffset||[0,0]),n.setZoom(h),n.setCenter(m),e.coordinateSystem=n})),e.eachSeries((function(e){"gmap"===e.get("coordinateSystem")&&(e.coordinateSystem=n)}))};var l=i;r.extendComponentModel({type:"gmap",setGoogleMap:function(e){this.__gmap=e},getGoogleMap:function(){return this.__gmap},setEChartsLayer:function(e){this.__echartsLayer=e},getEChartsLayer:function(){return this.__echartsLayer},setCenterAndZoom:function(e,t){this.option.center=e,this.option.zoom=t},centerOrZoomChanged:function(e,t){var n,o,r=this.option;return n=e,o=r.center,!(n&&o&&n[0]===o[0]&&n[1]===o[1]&&t===r.zoom)},defaultOption:{center:{lat:39.90923,lng:116.397428},zoom:5,echartsLayerZIndex:2e3,renderOnMoving:!0}});var f=n(2),g=n.n(f);r.extendComponentView({type:"gmap",render:function(e,t,n){var o=!0,i=e.getGoogleMap(),a=n.getZr().painter.getViewportRoot(),s=e.coordinateSystem,c=i.getDiv(),u=e.get("renderOnMoving"),p=c.clientWidth,l=c.clientHeight,f=function(){if(!o){var t=c.clientWidth,r=c.clientHeight;if(t!==p||r!==l)return d.call(this);var i=[-parseInt(c.style.left,10)||0,-parseInt(c.style.top,10)||0];a.style.left=i[0]+"px",a.style.top=i[1]+"px",s.setMapOffset(i),e.__mapOffset=i,n.dispatchAction({type:"gmapRoam"})}},d=function(){r.getInstanceByDom(n.getDom()).resize()};this._oldRenderHandler&&this._oldRenderHandler.remove(),u||(f=g()(f,100),d=g()(d,100)),this._oldRenderHandler=google.maps.event.addListener(i,"gmaprender",f),o=!1},dispose:function(e,t){this._oldRenderHandler&&this._oldRenderHandler.remove(),this._oldRenderHandler=null;var n=e.getComponent("gmap"),o=n.getGoogleMap();delete o.__overlayProjection,google.maps.event.clearInstanceListeners(o);var r=o.getDiv();r.parentNode.removeChild(r),n.setGoogleMap(null),n.setEChartsLayer(null),n.coordinateSystem.setGoogleMap(null),n.coordinateSystem=null}});r.registerCoordinateSystem("amap",l),r.registerAction({type:"gmapRoam",event:"gmapRoam",update:"updateLayout"},(function(e,t){t.eachComponent("gmap",(function(e){var t=e.getGoogleMap(),n=t.getCenter();e.setCenterAndZoom([n.lng(),n.lat()],t.getZoom())}))}))}])})); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],t):"object"==typeof exports?exports.gmap=t(require("echarts")):e.gmap=t(e.echarts)}(window,(function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(t,n){t.exports=e},function(e){e.exports=JSON.parse('{"a":"echarts-extension-gmap","b":"1.0.4"}')},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,u=s||c||Function("return this")(),p=Object.prototype.toString,l=Math.max,f=Math.min,g=function(){return u.Date.now()};function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function m(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==p.call(e)}(e))return NaN;if(d(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=d(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var s=r.test(e);return s||i.test(e)?a(e.slice(2),s?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var o,r,i,a,s,c,u=0,p=!1,h=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=o,i=r;return o=r=void 0,u=t,a=e.apply(i,n)}function _(e){return u=e,s=setTimeout(b,t),p?v(e):a}function x(e){var n=e-c;return void 0===c||n>=t||n<0||h&&e-u>=i}function b(){var e=g();if(x(e))return w(e);s=setTimeout(b,function(e){var n=t-(e-c);return h?f(n,i-(e-u)):n}(e))}function w(e){return s=void 0,y&&o?v(e):(o=r=void 0,a)}function O(){var e=g(),n=x(e);if(o=arguments,r=this,c=e,n){if(void 0===s)return _(c);if(h)return s=setTimeout(b,t),v(c)}return void 0===s&&(s=setTimeout(b,t)),a}return t=m(t)||0,d(n)&&(p=!!n.leading,i=(h="maxWait"in n)?l(m(n.maxWait)||0,t):i,y="trailing"in n?!!n.trailing:y),O.cancel=function(){void 0!==s&&clearTimeout(s),u=0,o=c=r=s=void 0},O.flush=function(){return void 0===s?a:w(g())},O}}).call(this,n(3))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"version",(function(){return o.b})),n.d(t,"name",(function(){return o.a}));var o=n(1),r=n(0);function i(e,t){this._gmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}var a,s=i.prototype,c=["echartsLayerZIndex","renderOnMoving"];function u(e,t){return t=t||[0,0],r.util.map([0,1],(function(n){var o=t[n],r=e[n]/2,i=[],a=[];return i[n]=o-r,a[n]=o+r,i[1-n]=a[1-n]=t[1-n],Math.abs(this.dataToPoint(i)[n]-this.dataToPoint(a)[n])}),this)}function p(e,t){var n=t.__overlayProjection;if(n)return n.fromLatLngToContainerPixel(e)}s.dimensions=["lng","lat"],s.setZoom=function(e){this._zoom=e},s.setCenter=function(e){var t=new google.maps.LatLng(e[1],e[0]);this._center=p(t,this._gmap)},s.setMapOffset=function(e){this._mapOffset=e},s.setGoogleMap=function(e){this._gmap=e},s.getGoogleMap=function(){return this._gmap},s.dataToPoint=function(e){var t=p(new google.maps.LatLng(e[1],e[0]),this._gmap);if(t){var n=this._mapOffset;return[t.x-n[0],t.y-n[1]]}},s.pointToData=function(e){var t=this._mapOffset,n=function(e,t){var n=t.__overlayProjection;if(!n)return;return n.fromContainerPixelToLatLng(e)}(new google.maps.Point(e[0]+t[0],e[1]+t[1]),this._gmap);return[n.lng(),n.lat()]},s.getViewRect=function(){var e=this._api;return new r.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},s.getRoamTransform=function(){return r.matrix.create()},s.prepareCustoms=function(e){var t=this.getViewRect();return{coordSys:{type:"gmap",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:r.util.bind(this.dataToPoint,this),size:r.util.bind(u,this)}}},i.dimensions=s.dimensions,i.create=function(e,t){var n,o=t.getDom();e.eachComponent("gmap",(function(e){var s=t.getZr().painter,u=s.getViewportRoot();if("undefined"==typeof google||void 0===google.maps||void 0===google.maps.Map)throw new Error("It seems that Google Map API has not been loaded completely yet.");if(a=a||function(){function e(e,t){this._root=e,this.setMap(t)}return e.prototype=new google.maps.OverlayView,e.prototype.onAdd=function(){var e=this.getMap();e.__overlayProjection=this.getProjection(),e.getDiv().querySelector(".gm-style > div").appendChild(this._root)},e.prototype.draw=function(){google.maps.event.trigger(this.getMap(),"gmaprender")},e.prototype.onRemove=function(){this._root.parentNode.removeChild(this._root),this._root=null},e.prototype.setZIndex=function(e){this._root.style.zIndex=e},e.prototype.getZIndex=function(){return this._root.style.zIndex},e}(),n)throw new Error("Only one google map component can exist");var p=e.getGoogleMap();if(!p){var l=o.querySelector(".ec-extension-google-map");l&&(u.style.left="0px",u.style.top="0px",u.style.width="100%",u.style.height="100%",o.removeChild(l)),(l=document.createElement("div")).style.cssText="width:100%;height:100%",l.classList.add("ec-extension-google-map"),o.appendChild(l);var f=r.util.clone(e.get()),g=f.echartsLayerZIndex;r.util.each(c,(function(e){delete f[e]}));var d=f.center;r.util.isArray(d)&&(f.center={lng:d[0],lat:d[1]}),p=new google.maps.Map(l,f),e.setGoogleMap(p),e.__projectionChangeListener&&e.__projectionChangeListener.remove(),e.__projectionChangeListener=google.maps.event.addListener(p,"projection_changed",(function(){var t=e.getEChartsLayer();t&&t.setMap(null);var n=new a(u,p);n.setZIndex(g),e.setEChartsLayer(n)})),s.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var m=[null!=(d=e.get("center")).lng?d.lng:d[0],null!=d.lat?d.lat:d[1]],h=e.get("zoom");if(d&&h){var y=p.getCenter(),v=p.getZoom();if(e.centerOrZoomChanged([y.lng(),y.lat()],v)){var _=new google.maps.LatLng(m[1],m[0]);p.setOptions({center:_,zoom:h})}}(n=new i(p,t)).setMapOffset(e.__mapOffset||[0,0]),n.setZoom(h),n.setCenter(m),e.coordinateSystem=n})),e.eachSeries((function(e){"gmap"===e.get("coordinateSystem")&&(e.coordinateSystem=n)}))};var l=i;r.extendComponentModel({type:"gmap",setGoogleMap:function(e){this.__gmap=e},getGoogleMap:function(){return this.__gmap},setEChartsLayer:function(e){this.__echartsLayer=e},getEChartsLayer:function(){return this.__echartsLayer},setCenterAndZoom:function(e,t){this.option.center=e,this.option.zoom=t},centerOrZoomChanged:function(e,t){var n,o,r=this.option;return n=e,o=r.center,!(n&&o&&n[0]===o[0]&&n[1]===o[1]&&t===r.zoom)},defaultOption:{center:{lat:39.90923,lng:116.397428},zoom:5,echartsLayerZIndex:2e3,renderOnMoving:!0}});var f=n(2),g=n.n(f);r.extendComponentView({type:"gmap",render:function(e,t,n){var o=!0,i=e.getGoogleMap(),a=n.getZr().painter.getViewportRoot(),s=e.coordinateSystem,c=i.getDiv(),u=e.get("renderOnMoving"),p=c.clientWidth,l=c.clientHeight,f=function(){if(!o){var t=c.clientWidth,r=c.clientHeight;if(t!==p||r!==l)return d.call(this);var i=[-parseInt(c.style.left,10)||0,-parseInt(c.style.top,10)||0];a.style.left=i[0]+"px",a.style.top=i[1]+"px",s.setMapOffset(i),e.__mapOffset=i,n.dispatchAction({type:"gmapRoam"})}},d=function(){r.getInstanceByDom(n.getDom()).resize()};this._oldRenderHandler&&this._oldRenderHandler.remove(),u||(f=g()(f,100),d=g()(d,100)),this._oldRenderHandler=google.maps.event.addListener(i,"gmaprender",f),o=!1},dispose:function(e,t){this._oldRenderHandler&&this._oldRenderHandler.remove(),this._oldRenderHandler=null;var n=e.getComponent("gmap"),o=n.getGoogleMap();delete o.__overlayProjection,google.maps.event.clearInstanceListeners(o);var r=o.getDiv();r.parentNode.removeChild(r),n.setGoogleMap(null),n.setEChartsLayer(null),n.coordinateSystem.setGoogleMap(null),n.coordinateSystem=null}});r.registerCoordinateSystem("amap",l),r.registerAction({type:"gmapRoam",event:"gmapRoam",update:"updateLayout"},(function(e,t){t.eachComponent("gmap",(function(e){var t=e.getGoogleMap(),n=t.getCenter();e.setCenterAndZoom([n.lng(),n.lat()],t.getZoom())}))}))}])})); //# sourceMappingURL=echarts-extension-gmap.min.js.map \ No newline at end of file diff --git a/package.json b/package.json index 7fae2e6..56f402a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "echarts-extension-gmap", - "version": "1.0.3", + "version": "1.0.4", "description": "An Google Map(https://www.google.com/maps) extension for ECharts(https://github.com/apache/incubator-echarts)", "main": "dist/echarts-extension-gmap.min.js", "scripts": {