Socket
Socket
Sign inDemoInstall

echarts-extension-gmap

Package Overview
Dependencies
1
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.3.1

17

dist/echarts-extension-gmap.js
/*!
* echarts-extension-gmap
* @version 1.3.0
* @version 1.3.1
* @author plainheart

@@ -36,3 +36,3 @@ *

var name = "echarts-extension-gmap";
var version = "1.3.0";
var version = "1.3.1";

@@ -82,7 +82,4 @@ /* global google */

var px = latLngToPixel(latlng, this._gmap);
if (px) {
var mapOffset = this._mapOffset;
return [px.x - mapOffset[0], px.y - mapOffset[1]];
}
return [];
var mapOffset = this._mapOffset;
return [px.x - mapOffset[0], px.y - mapOffset[1]];
};

@@ -180,3 +177,3 @@

gmapRoot.className = 'ec-extension-google-map';
gmapRoot.style.cssText = 'width:100%;height:100%';
gmapRoot.style.cssText = 'position:absolute;top:0;left:0;right:0;bottom:0;';
root.appendChild(gmapRoot);

@@ -296,3 +293,3 @@

if (!projection) {
return;
return new google.maps.Point(-Infinity, -Infinity);
}

@@ -306,3 +303,3 @@

if (!projection) {
return;
return new google.maps.Point(-Infinity, -Infinity);
}

@@ -309,0 +306,0 @@

/*!
* echarts-extension-gmap
* @version 1.3.0
* @version 1.3.1
* @author plainheart

@@ -29,2 +29,2 @@ *

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).echarts=e.echarts||{},e.echarts.gmap={}),e.echarts)}(this,(function(e,t){"use strict";function n(e,t){this._gmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}var o,r=n.prototype,i=["echartsLayerZIndex","renderOnMoving"];function a(e,n){return n=n||[0,0],t.util.map([0,1],(function(t){var o=n[t],r=e[t]/2,i=[],a=[];return i[t]=o-r,a[t]=o+r,i[1-t]=a[1-t]=n[1-t],Math.abs(this.dataToPoint(i)[t]-this.dataToPoint(a)[t])}),this)}function s(e,t){var n=t.__overlayProjection;if(n)return n.fromLatLngToContainerPixel(e)}r.dimensions=["lng","lat"],r.setZoom=function(e){this._zoom=e},r.setCenter=function(e){var t=new google.maps.LatLng(e[1],e[0]);this._center=s(t,this._gmap)},r.setMapOffset=function(e){this._mapOffset=e},r.setGoogleMap=function(e){this._gmap=e},r.getGoogleMap=function(){return this._gmap},r.dataToPoint=function(e){var t=s(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]]}return[]},r.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()]},r.getViewRect=function(){var e=this._api;return new t.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},r.getRoamTransform=function(){return t.matrix.create()},r.prepareCustoms=function(e){var n=this.getViewRect();return{coordSys:{type:"gmap",x:n.x,y:n.y,width:n.width,height:n.height},api:{coord:t.util.bind(this.dataToPoint,this),size:t.util.bind(a,this)}}},n.dimensions=r.dimensions,n.create=function(e,r){var a,s=r.getDom();e.eachComponent("gmap",(function(e){var f=r.getZr().painter,l=f.getViewportRoot();if("undefined"==typeof google||"undefined"==typeof google.maps||"undefined"==typeof google.maps.Map)throw new Error("It seems that Google Map API has not been loaded completely yet.");if(o=o||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}(),a)throw new Error("Only one google map component can exist");var p=e.getGoogleMap();if(!p){var u=s.querySelector(".ec-extension-google-map");u&&(l.style.left="0px",l.style.top="0px",l.style.width="100%",l.style.height="100%",s.removeChild(u)),(u=document.createElement("div")).className="ec-extension-google-map",u.style.cssText="width:100%;height:100%",s.appendChild(u);var c=t.util.clone(e.get()),g=c.echartsLayerZIndex;t.util.each(i,(function(e){delete c[e]}));var d=c.center;t.util.isArray(d)&&(c.center={lng:d[0],lat:d[1]}),p=new google.maps.Map(u,c),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 o(l,p);n.setZIndex(g),e.setEChartsLayer(n)})),f.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})}}(a=new n(p,r)).setMapOffset(e.__mapOffset||[0,0]),a.setZoom(h),a.setCenter(m),e.coordinateSystem=a})),e.eachSeries((function(e){"gmap"===e.get("coordinateSystem")&&(e.coordinateSystem=a)}))},t.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="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,g=parseInt,d="object"==typeof f&&f&&f.Object===Object&&f,m="object"==typeof self&&self&&self.Object===Object&&self,h=d||m||Function("return this")(),y=Object.prototype.toString,v=Math.max,_=Math.min,x=function(){return h.Date.now()};function w(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function C(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==y.call(e)}(e))return NaN;if(w(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=u.test(e);return n||c.test(e)?g(e.slice(2),n?2:8):p.test(e)?NaN:+e}var M=function(e,t,n){var o,r,i,a,s,f,l=0,p=!1,u=!1,c=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var n=o,i=r;return o=r=undefined,l=t,a=e.apply(i,n)}function d(e){return l=e,s=setTimeout(h,t),p?g(e):a}function m(e){var n=e-f;return f===undefined||n>=t||n<0||u&&e-l>=i}function h(){var e=x();if(m(e))return y(e);s=setTimeout(h,function(e){var n=t-(e-f);return u?_(n,i-(e-l)):n}(e))}function y(e){return s=undefined,c&&o?g(e):(o=r=undefined,a)}function M(){var e=x(),n=m(e);if(o=arguments,r=this,f=e,n){if(s===undefined)return d(f);if(u)return s=setTimeout(h,t),g(f)}return s===undefined&&(s=setTimeout(h,t)),a}return t=C(t)||0,w(n)&&(p=!!n.leading,i=(u="maxWait"in n)?v(C(n.maxWait)||0,t):i,c="trailing"in n?!!n.trailing:c),M.cancel=function(){s!==undefined&&clearTimeout(s),l=0,o=f=r=s=undefined},M.flush=function(){return s===undefined?a:y(x())},M};t.extendComponentView({type:"gmap",render:function(e,n,o){var r=!0,i=e.getGoogleMap(),a=o.getZr().painter.getViewportRoot(),s=e.coordinateSystem,f=i.getDiv(),l=e.get("renderOnMoving"),p=f.clientWidth,u=f.clientHeight,c=function(){if(!r){var t=f.clientWidth,n=f.clientHeight;if(t!==p||n!==u)return g.call(this);var i=[-parseInt(f.style.left,10)||0,-parseInt(f.style.top,10)||0];a.style.left=i[0]+"px",a.style.top=i[1]+"px",s.setMapOffset(i),e.__mapOffset=i,o.dispatchAction({type:"gmapRoam",animation:{duration:0}})}},g=function(){t.getInstanceByDom(o.getDom()).resize()};this._oldRenderHandler&&this._oldRenderHandler.remove(),l||(c=M(c,100),g=M(g,100)),this._oldRenderHandler=google.maps.event.addListener(i,"gmaprender",c),r=!1},dispose:function(e,t){this._oldRenderHandler&&this._oldRenderHandler.remove(),this._oldRenderHandler=null;var n=e.getComponent("gmap");if(n){var o=n.getGoogleMap();if(o){delete o.__overlayProjection,google.maps.event.clearInstanceListeners(o);var r=o.getDiv();r.parentNode&&r.parentNode.removeChild(r)}n.setGoogleMap(null),n.setEChartsLayer(null),n.coordinateSystem&&(n.coordinateSystem.setGoogleMap(null),n.coordinateSystem=null)}}}),t.registerCoordinateSystem("gmap",n),t.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())}))})),e.name="echarts-extension-gmap",e.version="1.3.0",Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).echarts=e.echarts||{},e.echarts.gmap={}),e.echarts)}(this,(function(e,t){"use strict";function n(e,t){this._gmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}var o,i=n.prototype,r=["echartsLayerZIndex","renderOnMoving"];function a(e,n){return n=n||[0,0],t.util.map([0,1],(function(t){var o=n[t],i=e[t]/2,r=[],a=[];return r[t]=o-i,a[t]=o+i,r[1-t]=a[1-t]=n[1-t],Math.abs(this.dataToPoint(r)[t]-this.dataToPoint(a)[t])}),this)}function s(e,t){var n=t.__overlayProjection;return n?n.fromLatLngToContainerPixel(e):new google.maps.Point(-Infinity,-Infinity)}i.dimensions=["lng","lat"],i.setZoom=function(e){this._zoom=e},i.setCenter=function(e){var t=new google.maps.LatLng(e[1],e[0]);this._center=s(t,this._gmap)},i.setMapOffset=function(e){this._mapOffset=e},i.setGoogleMap=function(e){this._gmap=e},i.getGoogleMap=function(){return this._gmap},i.dataToPoint=function(e){var t=s(new google.maps.LatLng(e[1],e[0]),this._gmap),n=this._mapOffset;return[t.x-n[0],t.y-n[1]]},i.pointToData=function(e){var t=this._mapOffset,n=function(e,t){var n=t.__overlayProjection;if(!n)return new google.maps.Point(-Infinity,-Infinity);return n.fromContainerPixelToLatLng(e)}(new google.maps.Point(e[0]+t[0],e[1]+t[1]),this._gmap);return[n.lng(),n.lat()]},i.getViewRect=function(){var e=this._api;return new t.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},i.getRoamTransform=function(){return t.matrix.create()},i.prepareCustoms=function(e){var n=this.getViewRect();return{coordSys:{type:"gmap",x:n.x,y:n.y,width:n.width,height:n.height},api:{coord:t.util.bind(this.dataToPoint,this),size:t.util.bind(a,this)}}},n.dimensions=i.dimensions,n.create=function(e,i){var a,s=i.getDom();e.eachComponent("gmap",(function(e){var f=i.getZr().painter,l=f.getViewportRoot();if("undefined"==typeof google||"undefined"==typeof google.maps||"undefined"==typeof google.maps.Map)throw new Error("It seems that Google Map API has not been loaded completely yet.");if(o=o||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}(),a)throw new Error("Only one google map component can exist");var p=e.getGoogleMap();if(!p){var u=s.querySelector(".ec-extension-google-map");u&&(l.style.left="0px",l.style.top="0px",l.style.width="100%",l.style.height="100%",s.removeChild(u)),(u=document.createElement("div")).className="ec-extension-google-map",u.style.cssText="position:absolute;top:0;left:0;right:0;bottom:0;",s.appendChild(u);var g=t.util.clone(e.get()),c=g.echartsLayerZIndex;t.util.each(r,(function(e){delete g[e]}));var d=g.center;t.util.isArray(d)&&(g.center={lng:d[0],lat:d[1]}),p=new google.maps.Map(u,g),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 o(l,p);n.setZIndex(c),e.setEChartsLayer(n)})),f.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})}}(a=new n(p,i)).setMapOffset(e.__mapOffset||[0,0]),a.setZoom(h),a.setCenter(m),e.coordinateSystem=a})),e.eachSeries((function(e){"gmap"===e.get("coordinateSystem")&&(e.coordinateSystem=a)}))},t.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,i=this.option;return n=e,o=i.center,!(n&&o&&n[0]===o[0]&&n[1]===o[1]&&t===i.zoom)},defaultOption:{center:{lat:39.90923,lng:116.397428},zoom:5,echartsLayerZIndex:2e3,renderOnMoving:!0}});var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,g=/^0o[0-7]+$/i,c=parseInt,d="object"==typeof f&&f&&f.Object===Object&&f,m="object"==typeof self&&self&&self.Object===Object&&self,h=d||m||Function("return this")(),y=Object.prototype.toString,v=Math.max,_=Math.min,w=function(){return h.Date.now()};function x(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function C(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==y.call(e)}(e))return NaN;if(x(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=x(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=u.test(e);return n||g.test(e)?c(e.slice(2),n?2:8):p.test(e)?NaN:+e}var M=function(e,t,n){var o,i,r,a,s,f,l=0,p=!1,u=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function c(t){var n=o,r=i;return o=i=undefined,l=t,a=e.apply(r,n)}function d(e){return l=e,s=setTimeout(h,t),p?c(e):a}function m(e){var n=e-f;return f===undefined||n>=t||n<0||u&&e-l>=r}function h(){var e=w();if(m(e))return y(e);s=setTimeout(h,function(e){var n=t-(e-f);return u?_(n,r-(e-l)):n}(e))}function y(e){return s=undefined,g&&o?c(e):(o=i=undefined,a)}function M(){var e=w(),n=m(e);if(o=arguments,i=this,f=e,n){if(s===undefined)return d(f);if(u)return s=setTimeout(h,t),c(f)}return s===undefined&&(s=setTimeout(h,t)),a}return t=C(t)||0,x(n)&&(p=!!n.leading,r=(u="maxWait"in n)?v(C(n.maxWait)||0,t):r,g="trailing"in n?!!n.trailing:g),M.cancel=function(){s!==undefined&&clearTimeout(s),l=0,o=f=i=s=undefined},M.flush=function(){return s===undefined?a:y(w())},M};t.extendComponentView({type:"gmap",render:function(e,n,o){var i=!0,r=e.getGoogleMap(),a=o.getZr().painter.getViewportRoot(),s=e.coordinateSystem,f=r.getDiv(),l=e.get("renderOnMoving"),p=f.clientWidth,u=f.clientHeight,g=function(){if(!i){var t=f.clientWidth,n=f.clientHeight;if(t!==p||n!==u)return c.call(this);var r=[-parseInt(f.style.left,10)||0,-parseInt(f.style.top,10)||0];a.style.left=r[0]+"px",a.style.top=r[1]+"px",s.setMapOffset(r),e.__mapOffset=r,o.dispatchAction({type:"gmapRoam",animation:{duration:0}})}},c=function(){t.getInstanceByDom(o.getDom()).resize()};this._oldRenderHandler&&this._oldRenderHandler.remove(),l||(g=M(g,100),c=M(c,100)),this._oldRenderHandler=google.maps.event.addListener(r,"gmaprender",g),i=!1},dispose:function(e,t){this._oldRenderHandler&&this._oldRenderHandler.remove(),this._oldRenderHandler=null;var n=e.getComponent("gmap");if(n){var o=n.getGoogleMap();if(o){delete o.__overlayProjection,google.maps.event.clearInstanceListeners(o);var i=o.getDiv();i.parentNode&&i.parentNode.removeChild(i)}n.setGoogleMap(null),n.setEChartsLayer(null),n.coordinateSystem&&(n.coordinateSystem.setGoogleMap(null),n.coordinateSystem=null)}}}),t.registerCoordinateSystem("gmap",n),t.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())}))})),e.name="echarts-extension-gmap",e.version="1.3.1",Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "echarts-extension-gmap",
"version": "1.3.0",
"description": "An Google Map(https://www.google.com/maps) extension for Apache ECharts (incubating) (https://github.com/apache/incubator-echarts)",
"version": "1.3.1",
"description": "A Google Map(https://www.google.com/maps) extension for Apache ECharts (https://github.com/apache/echarts)",
"main": "dist/echarts-extension-gmap.min.js",
"files": [
"dist",
"src",
"examples/*.html"
],
"scripts": {

@@ -7,0 +12,0 @@ "dev": "node build/build.js",

@@ -7,3 +7,3 @@ [![NPM version](https://img.shields.io/npm/v/echarts-extension-gmap.svg?style=flat)](https://www.npmjs.org/package/echarts-extension-gmap)

## Google Map extension for Apache ECharts (incubating)
## Google Map extension for Apache ECharts

@@ -10,0 +10,0 @@ [中文说明](https://github.com/plainheart/echarts-extension-gmap/blob/master/README.zh-CN.md)

@@ -7,3 +7,3 @@ [![NPM version](https://img.shields.io/npm/v/echarts-extension-gmap.svg?style=flat)](https://www.npmjs.org/package/echarts-extension-gmap)

## Apache ECharts (incubating) 谷歌地图扩展
## Apache ECharts 谷歌地图扩展

@@ -10,0 +10,0 @@ [README_EN](https://github.com/plainheart/echarts-extension-gmap/blob/master/README.md)

@@ -46,7 +46,4 @@ /* global google */

var px = latLngToPixel(latlng, this._gmap);
if (px) {
var mapOffset = this._mapOffset;
return [px.x - mapOffset[0], px.y - mapOffset[1]];
}
return [];
var mapOffset = this._mapOffset;
return [px.x - mapOffset[0], px.y - mapOffset[1]];
};

@@ -144,3 +141,3 @@

gmapRoot.className = 'ec-extension-google-map';
gmapRoot.style.cssText = 'width:100%;height:100%';
gmapRoot.style.cssText = 'position:absolute;top:0;left:0;right:0;bottom:0;';
root.appendChild(gmapRoot);

@@ -260,3 +257,3 @@

if (!projection) {
return;
return new google.maps.Point(-Infinity, -Infinity);
}

@@ -270,3 +267,3 @@

if (!projection) {
return;
return new google.maps.Point(-Infinity, -Infinity);
}

@@ -273,0 +270,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc