Skip to content

Commit

Permalink
[release] release 1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
plainheart committed Feb 26, 2021
1 parent 2a4b6c3 commit b7722eb
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 42 deletions.
33 changes: 23 additions & 10 deletions dist/echarts-extension-amap.cjs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* echarts-extension-amap
* @version 1.9.0
* @version 1.9.1
* @author plainheart
*
* MIT License
Expand Down Expand Up @@ -127,11 +127,7 @@ AMapCoordSysProto.prepareCustoms = function () {

AMapCoordSys.create = function (ecModel, api) {
var amapCoordSys;
var root = api.getDom();
ecModel.eachComponent('amap', function (amapModel) {
var painter = api.getZr().painter;
var viewportRoot = painter.getViewportRoot();

if (typeof AMap === 'undefined') {
throw new Error('AMap api is not loaded');
}
Expand All @@ -144,7 +140,12 @@ AMapCoordSys.create = function (ecModel, api) {
var echartsLayerInteractive = amapModel.get('echartsLayerInteractive');

if (!amap) {
// Not support IE8
var root = api.getDom();
var painter = api.getZr().painter;
var viewportRoot = painter.getViewportRoot(); // PENDING not hidden?

viewportRoot.style.visibility = 'hidden'; // Not support IE8

var amapRoot = root.querySelector('.ec-extension-amap');

if (amapRoot) {
Expand All @@ -170,8 +171,13 @@ AMapCoordSys.create = function (ecModel, api) {
delete options[key];
});
amap = new AMap.Map(amapRoot, options);
amapModel.setAMap(amap);
amapRoot.querySelector('.amap-maps').appendChild(viewportRoot);
amapModel.setAMap(amap); // use `complete` callback to avoid NPE when first load amap

amap.on('complete', function () {
amapRoot.querySelector('.amap-maps').appendChild(viewportRoot); // PENDING

viewportRoot.style.visibility = '';
});
amapModel.setEChartsLayer(viewportRoot); // Override

painter.getViewportRootOffset = function () {
Expand All @@ -182,7 +188,13 @@ AMapCoordSys.create = function (ecModel, api) {
};
}

amapModel.setEChartsLayerInteractive(echartsLayerInteractive);
var oldEChartsLayerInteractive = amapModel.__echartsLayerInteractive;

if (oldEChartsLayerInteractive !== echartsLayerInteractive) {
amapModel.setEChartsLayerInteractive(echartsLayerInteractive);
amapModel.__echartsLayerInteractive = echartsLayerInteractive;
}

var center = amapModel.get('center');
var zoom = amapModel.get('zoom');

Expand Down Expand Up @@ -256,6 +268,7 @@ var AMapModel = {
},
// FIXME: NOT SUPPORT <= IE 10
setEChartsLayerInteractive: function setEChartsLayerInteractive(interactive) {
this.option.echartsLayerInteractive = !!interactive;
this.__echartsLayer.style.pointerEvents = interactive ? 'auto' : 'none';
},
setCenterAndZoom: function setCenterAndZoom(center, zoom) {
Expand Down Expand Up @@ -824,7 +837,7 @@ var AMapView = {
var AMapView$1 = isV5 ? echarts$1.ComponentView.extend(AMapView) : AMapView;

var name = "echarts-extension-amap";
var version = "1.9.0";
var version = "1.9.1";

/**
* AMap component extension
Expand Down
33 changes: 23 additions & 10 deletions dist/echarts-extension-amap.esm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* echarts-extension-amap
* @version 1.9.0
* @version 1.9.1
* @author plainheart
*
* MIT License
Expand Down Expand Up @@ -124,11 +124,7 @@ AMapCoordSysProto.prepareCustoms = function () {

AMapCoordSys.create = function (ecModel, api) {
var amapCoordSys;
var root = api.getDom();
ecModel.eachComponent('amap', function (amapModel) {
var painter = api.getZr().painter;
var viewportRoot = painter.getViewportRoot();

if (typeof AMap === 'undefined') {
throw new Error('AMap api is not loaded');
}
Expand All @@ -141,7 +137,12 @@ AMapCoordSys.create = function (ecModel, api) {
var echartsLayerInteractive = amapModel.get('echartsLayerInteractive');

if (!amap) {
// Not support IE8
var root = api.getDom();
var painter = api.getZr().painter;
var viewportRoot = painter.getViewportRoot(); // PENDING not hidden?

viewportRoot.style.visibility = 'hidden'; // Not support IE8

var amapRoot = root.querySelector('.ec-extension-amap');

if (amapRoot) {
Expand All @@ -167,8 +168,13 @@ AMapCoordSys.create = function (ecModel, api) {
delete options[key];
});
amap = new AMap.Map(amapRoot, options);
amapModel.setAMap(amap);
amapRoot.querySelector('.amap-maps').appendChild(viewportRoot);
amapModel.setAMap(amap); // use `complete` callback to avoid NPE when first load amap

amap.on('complete', function () {
amapRoot.querySelector('.amap-maps').appendChild(viewportRoot); // PENDING

viewportRoot.style.visibility = '';
});
amapModel.setEChartsLayer(viewportRoot); // Override

painter.getViewportRootOffset = function () {
Expand All @@ -179,7 +185,13 @@ AMapCoordSys.create = function (ecModel, api) {
};
}

amapModel.setEChartsLayerInteractive(echartsLayerInteractive);
var oldEChartsLayerInteractive = amapModel.__echartsLayerInteractive;

if (oldEChartsLayerInteractive !== echartsLayerInteractive) {
amapModel.setEChartsLayerInteractive(echartsLayerInteractive);
amapModel.__echartsLayerInteractive = echartsLayerInteractive;
}

var center = amapModel.get('center');
var zoom = amapModel.get('zoom');

Expand Down Expand Up @@ -253,6 +265,7 @@ var AMapModel = {
},
// FIXME: NOT SUPPORT <= IE 10
setEChartsLayerInteractive: function setEChartsLayerInteractive(interactive) {
this.option.echartsLayerInteractive = !!interactive;
this.__echartsLayer.style.pointerEvents = interactive ? 'auto' : 'none';
},
setCenterAndZoom: function setCenterAndZoom(center, zoom) {
Expand Down Expand Up @@ -821,7 +834,7 @@ var AMapView = {
var AMapView$1 = isV5 ? ComponentView.extend(AMapView) : AMapView;

var name = "echarts-extension-amap";
var version = "1.9.0";
var version = "1.9.1";

/**
* AMap component extension
Expand Down
35 changes: 24 additions & 11 deletions dist/echarts-extension-amap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/echarts-extension-amap.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/echarts-extension-amap.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/echarts-extension-amap.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/heatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
<!-- echarts amap extension -->
<!-- <script type="text/javascript" src="../dist/echarts-extension-amap.min.js"></script> -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<style type="text/css">
* {
Expand Down
2 changes: 1 addition & 1 deletion examples/heatmap_zh_CN.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
<!-- 引入ECharts高德地图扩展 -->
<!-- <script type="text/javascript" src="../dist/echarts-extension-amap.min.js"></script> -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<style type="text/css">
* {
Expand Down
2 changes: 1 addition & 1 deletion examples/lines.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
<!-- echarts amap extension -->
<!-- <script type="text/javascript" src="../dist/echarts-extension-amap.min.js"></script> -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<style type="text/css">
* {
Expand Down
2 changes: 1 addition & 1 deletion examples/lines_zh_CN.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
<!-- 引入ECharts高德地图扩展 -->
<!-- <script type="text/javascript" src="../dist/echarts-extension-amap.min.js"></script> -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<style type="text/css">
* {
Expand Down
2 changes: 1 addition & 1 deletion examples/scatter.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
<!-- echarts amap extension -->
<!-- <script type="text/javascript" src="../dist/echarts-extension-amap.min.js"></script> -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/echarts-extension-amap.min.js"></script>
<style type="text/css">
* {
margin: 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/scatter_zh_CN.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
<!-- 引入ECharts高德地图扩展 -->
<!-- <script type="text/javascript" src="../dist/echarts-extension-amap.min.js"></script> -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/echarts-extension-amap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/echarts-extension-amap.min.js"></script>
<style type="text/css">
* {
margin: 0;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "echarts-extension-amap",
"version": "1.9.0",
"version": "1.9.1",
"description": "An AMap(https://lbs.amap.com) extension for Apache ECharts (https://github.com/apache/echarts)",
"main": "dist/echarts-extension-amap.min.js",
"module": "dist/echarts-extension-amap.esm.js",
Expand Down

0 comments on commit b7722eb

Please sign in to comment.