echarts-extension-gmap
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,2 +0,1 @@ | ||
!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.1.0"}')},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,u="object"==typeof self&&self&&self.Object===Object&&self,c=s||u||Function("return this")(),p=Object.prototype.toString,l=Math.max,f=Math.min,g=function(){return c.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,u,c=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,c=t,a=e.apply(i,n)}function _(e){return c=e,s=setTimeout(b,t),p?v(e):a}function x(e){var n=e-u;return void 0===u||n>=t||n<0||h&&e-c>=i}function b(){var e=g();if(x(e))return w(e);s=setTimeout(b,function(e){var n=t-(e-u);return h?f(n,i-(e-c)):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,u=e,n){if(void 0===s)return _(u);if(h)return s=setTimeout(b,t),v(u)}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),c=0,o=u=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,u=["echartsLayerZIndex","renderOnMoving"];function c(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(c,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,c=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&&(c.style.left="0px",c.style.top="0px",c.style.width="100%",c.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(u,(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(c,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,u=i.getDiv(),c=e.get("renderOnMoving"),p=u.clientWidth,l=u.clientHeight,f=function(){if(!o){var t=u.clientWidth,r=u.clientHeight;if(t!==p||r!==l)return d.call(this);var i=[-parseInt(u.style.left,10)||0,-parseInt(u.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",animation:{duration:0}})}},d=function(){r.getInstanceByDom(n.getDom()).resize()};this._oldRenderHandler&&this._oldRenderHandler.remove(),c||(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 | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define("gmap",["echarts"],t):"object"==typeof exports?exports.gmap=t(require("echarts")):(e.echarts=e.echarts||{},e.echarts.gmap=t(e.echarts))}(this,(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.2.0"}')},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",animation:{duration:0}})}},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("gmap",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())}))}))}])})); |
{ | ||
"name": "echarts-extension-gmap", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "An Google Map(https://www.google.com/maps) extension for Apache ECharts (incubating) (https://github.com/apache/incubator-echarts)", | ||
"main": "dist/echarts-extension-gmap.min.js", | ||
"scripts": { | ||
"build": "webpack -p", | ||
"dev": "webpack -d", | ||
"watch": "webpack -d --watch", | ||
"build": "webpack --env=production --optimize-minimize --progress --colors", | ||
"dev": "webpack --env=development", | ||
"watch": "webpack --env=development --watch", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -40,5 +40,4 @@ }, | ||
"dependencies": { | ||
"echarts": "^4.7.0", | ||
"lodash.debounce": "^4.0.8" | ||
} | ||
} |
/* global google */ | ||
import { util as zrUtil, graphic, matrix } from "echarts"; | ||
import { util as zrUtil, graphic, matrix } from 'echarts'; | ||
function GMapCoordSys(gmap, api) { | ||
this._gmap = gmap; | ||
this.dimensions = ["lng", "lat"]; | ||
this.dimensions = ['lng', 'lat']; | ||
this._mapOffset = [0, 0]; | ||
@@ -16,7 +16,7 @@ this._api = api; | ||
var excludedOptions = [ | ||
"echartsLayerZIndex", | ||
"renderOnMoving" | ||
'echartsLayerZIndex', | ||
'renderOnMoving' | ||
]; | ||
GMapCoordSysProto.dimensions = ["lng", "lat"]; | ||
GMapCoordSysProto.dimensions = ['lng', 'lat']; | ||
@@ -76,3 +76,3 @@ GMapCoordSysProto.setZoom = function(zoom) { | ||
// The name exposed to user is always 'cartesian2d' but not 'grid'. | ||
type: "gmap", | ||
type: 'gmap', | ||
x: rect.x, | ||
@@ -117,13 +117,13 @@ y: rect.y, | ||
ecModel.eachComponent("gmap", function(gmapModel) { | ||
ecModel.eachComponent('gmap', function(gmapModel) { | ||
var painter = api.getZr().painter; | ||
var viewportRoot = painter.getViewportRoot(); | ||
if (typeof google === "undefined" | ||
|| typeof google.maps === "undefined" | ||
|| typeof google.maps.Map === "undefined") { | ||
throw new Error("It seems that Google Map API has not been loaded completely yet."); | ||
if (typeof google === 'undefined' | ||
|| typeof google.maps === 'undefined' | ||
|| typeof google.maps.Map === 'undefined') { | ||
throw new Error('It seems that Google Map API has not been loaded completely yet.'); | ||
} | ||
Overlay = Overlay || createOverlayCtor(); | ||
if (gmapCoordSys) { | ||
throw new Error("Only one google map component can exist"); | ||
throw new Error('Only one google map component can exist'); | ||
} | ||
@@ -133,16 +133,16 @@ var gmap = gmapModel.getGoogleMap(); | ||
// Not support IE8 | ||
var gmapRoot = root.querySelector(".ec-extension-google-map"); | ||
var gmapRoot = root.querySelector('.ec-extension-google-map'); | ||
if (gmapRoot) { | ||
// Reset viewport left and top, which will be changed | ||
// in moving handler in AMapView | ||
viewportRoot.style.left = "0px"; | ||
viewportRoot.style.top = "0px"; | ||
viewportRoot.style.width = "100%"; | ||
viewportRoot.style.height = "100%"; | ||
// in moving handler in GMapView | ||
viewportRoot.style.left = '0px'; | ||
viewportRoot.style.top = '0px'; | ||
viewportRoot.style.width = '100%'; | ||
viewportRoot.style.height = '100%'; | ||
root.removeChild(gmapRoot); | ||
} | ||
gmapRoot = document.createElement("div"); | ||
gmapRoot.style.cssText = "width:100%;height:100%"; | ||
gmapRoot = document.createElement('div'); | ||
gmapRoot.style.cssText = 'width:100%;height:100%'; | ||
// Not support IE8 | ||
gmapRoot.classList.add("ec-extension-google-map"); | ||
gmapRoot.classList.add('ec-extension-google-map'); | ||
root.appendChild(gmapRoot); | ||
@@ -169,10 +169,12 @@ | ||
gmapModel.__projectionChangeListener && gmapModel.__projectionChangeListener.remove(); | ||
gmapModel.__projectionChangeListener = google.maps.event.addListener(gmap, "projection_changed", function() { | ||
var layer = gmapModel.getEChartsLayer(); | ||
layer && layer.setMap(null); | ||
gmapModel.__projectionChangeListener = google.maps.event.addListener(gmap, 'projection_changed', | ||
function() { | ||
var layer = gmapModel.getEChartsLayer(); | ||
layer && layer.setMap(null); | ||
var overlay = new Overlay(viewportRoot, gmap); | ||
overlay.setZIndex(echartsLayerZIndex); | ||
gmapModel.setEChartsLayer(overlay); | ||
}); | ||
var overlay = new Overlay(viewportRoot, gmap); | ||
overlay.setZIndex(echartsLayerZIndex); | ||
gmapModel.setEChartsLayer(overlay); | ||
} | ||
); | ||
@@ -185,3 +187,3 @@ // Override | ||
var center = gmapModel.get("center"); | ||
var center = gmapModel.get('center'); | ||
var normalizedCenter = [ | ||
@@ -191,3 +193,3 @@ center.lng != null ? center.lng : center[0], | ||
]; | ||
var zoom = gmapModel.get("zoom"); | ||
var zoom = gmapModel.get('zoom'); | ||
if (center && zoom) { | ||
@@ -215,3 +217,3 @@ var gmapCenter = gmap.getCenter(); | ||
ecModel.eachSeries(function(seriesModel) { | ||
if (seriesModel.get("coordinateSystem") === "gmap") { | ||
if (seriesModel.get('coordinateSystem') === 'gmap') { | ||
seriesModel.coordinateSystem = gmapCoordSys; | ||
@@ -235,3 +237,3 @@ } | ||
gmap.__overlayProjection = this.getProjection(); | ||
gmap.getDiv().querySelector(".gm-style > div").appendChild(this._root); | ||
gmap.getDiv().querySelector('.gm-style > div').appendChild(this._root); | ||
}; | ||
@@ -243,3 +245,3 @@ | ||
Overlay.prototype.draw = function() { | ||
google.maps.event.trigger(this.getMap(), "gmaprender"); | ||
google.maps.event.trigger(this.getMap(), 'gmaprender'); | ||
}; | ||
@@ -246,0 +248,0 @@ |
@@ -1,2 +0,2 @@ | ||
import * as echarts from "echarts"; | ||
import * as echarts from 'echarts'; | ||
@@ -8,3 +8,3 @@ function v2Equal(a, b) { | ||
export default echarts.extendComponentModel({ | ||
type: "gmap", | ||
type: 'gmap', | ||
@@ -11,0 +11,0 @@ setGoogleMap: function(gmap) { |
/* global google */ | ||
import * as echarts from "echarts"; | ||
import debounce from "lodash.debounce"; | ||
import * as echarts from 'echarts'; | ||
import debounce from 'lodash.debounce'; | ||
export default echarts.extendComponentView({ | ||
type: "gmap", | ||
type: 'gmap', | ||
@@ -16,3 +16,3 @@ render: function(gmapModel, ecModel, api) { | ||
var offsetEl = gmap.getDiv(); | ||
var renderOnMoving = gmapModel.get("renderOnMoving"); | ||
var renderOnMoving = gmapModel.get('renderOnMoving'); | ||
var oldWidth = offsetEl.clientWidth; | ||
@@ -37,4 +37,4 @@ var oldHeight = offsetEl.clientHeight; | ||
]; | ||
viewportRoot.style.left = mapOffset[0] + "px"; | ||
viewportRoot.style.top = mapOffset[1] + "px"; | ||
viewportRoot.style.left = mapOffset[0] + 'px'; | ||
viewportRoot.style.top = mapOffset[1] + 'px'; | ||
@@ -45,3 +45,3 @@ coordSys.setMapOffset(mapOffset); | ||
api.dispatchAction({ | ||
type: "gmapRoam", | ||
type: 'gmapRoam', | ||
animation: { | ||
@@ -67,3 +67,3 @@ // in ECharts 5.x, | ||
this._oldRenderHandler = google.maps.event.addListener(gmap, "gmaprender", renderHandler); | ||
this._oldRenderHandler = google.maps.event.addListener(gmap, 'gmaprender', renderHandler); | ||
@@ -77,3 +77,3 @@ rendering = false; | ||
var component = ecModel.getComponent("gmap"); | ||
var component = ecModel.getComponent('gmap'); | ||
var gmapInstance = component.getGoogleMap(); | ||
@@ -80,0 +80,0 @@ |
/** | ||
* AMap component extension | ||
* Google Map component extension | ||
*/ | ||
import { version, name } from "../package.json"; | ||
import { version, name } from '../package.json'; | ||
import * as echarts from "echarts"; | ||
import AMapCoordSys from "./GMapCoordSys"; | ||
import * as echarts from 'echarts'; | ||
import GMapCoordSys from './GMapCoordSys'; | ||
import "./GMapModel"; | ||
import "./GMapView"; | ||
import './GMapModel'; | ||
import './GMapView'; | ||
echarts.registerCoordinateSystem("amap", AMapCoordSys); | ||
echarts.registerCoordinateSystem('gmap', GMapCoordSys); | ||
@@ -18,8 +18,8 @@ // Action | ||
{ | ||
type: "gmapRoam", | ||
event: "gmapRoam", | ||
update: "updateLayout" | ||
type: 'gmapRoam', | ||
event: 'gmapRoam', | ||
update: 'updateLayout' | ||
}, | ||
function(payload, ecModel) { | ||
ecModel.eachComponent("gmap", function(gmapModel) { | ||
ecModel.eachComponent('gmap', function(gmapModel) { | ||
var gmap = gmapModel.getGoogleMap(); | ||
@@ -26,0 +26,0 @@ var center = gmap.getCenter(); |
@@ -1,18 +0,27 @@ | ||
var webpack = require("webpack"); | ||
var isProd = process.argv.indexOf("-p") > -1; | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
module.exports = { | ||
entry: { | ||
'gmap': __dirname + "/src/index.js" | ||
}, | ||
output: { | ||
libraryTarget: "umd", | ||
library: ["[name]"], | ||
path: __dirname + "/dist", | ||
filename: "echarts-extension-" + (isProd ? "[name].min.js" : "[name].js") | ||
}, | ||
devtool: isProd ? "source-map" : "cheap-module-source-map", | ||
externals: { | ||
echarts: "echarts" | ||
const ENTRY_NAME = 'gmap'; | ||
module.exports = function (env, argv) { | ||
const isProd = env === 'production'; | ||
return { | ||
mode: isProd ? 'production' : 'development', | ||
entry: { | ||
[ENTRY_NAME]: './src/index.js' | ||
}, | ||
output: { | ||
libraryTarget: 'umd', | ||
library: ['echarts', ENTRY_NAME], | ||
umdNamedDefine: true, | ||
globalObject: 'this', | ||
path: path.resolve(__dirname, './dist'), | ||
pathinfo: !isProd, | ||
filename: 'echarts-extension-' + (isProd ? '[name].min.js' : '[name].js') | ||
}, | ||
devtool: isProd ? false : 'source-map', | ||
externals: { | ||
echarts: 'echarts' | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1
1282
0
4
132462
- Removedecharts@^4.7.0
- Removedecharts@4.9.0(transitive)
- Removedzrender@4.3.2(transitive)