Skip to content

Commit 26013a0

Browse files
committed
fix leaflet echartsLayer 时间线等不能显示问题
1 parent a84dbad commit 26013a0

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

dist/iclient9-leaflet.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-leaflet.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65819,11 +65819,10 @@ var EchartsLayer = exports.EchartsLayer = _leaflet2["default"].Layer.extend({
6581965819
* @param LeafletMap - {L.map} 地图
6582065820
* @param api - {Object} 接口
6582165821
*/
65822-
function LeafletMapCoordSys(LeafletMap, api) {
65822+
function LeafletMapCoordSys(LeafletMap) {
6582365823
this._LeafletMap = LeafletMap;
6582465824
this.dimensions = ['lng', 'lat'];
6582565825
this._mapOffset = [0, 0];
65826-
this._api = api;
6582765826
}
6582865827

6582965828
LeafletMapCoordSys.prototype.dimensions = ['lng', 'lat'];
@@ -65900,8 +65899,8 @@ LeafletMapCoordSys.prototype.pointToData = function (pt) {
6590065899
};
6590165900

6590265901
LeafletMapCoordSys.prototype.getViewRect = function () {
65903-
var api = this._api;
65904-
return new _echarts2["default"].graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());
65902+
var size = this._LeafletMap.getSize();
65903+
return new _echarts2["default"].graphic.BoundingRect(0, 0, size.x, size.y);
6590565904
};
6590665905

6590765906
LeafletMapCoordSys.prototype.getRoamTransform = function () {
@@ -65914,17 +65913,18 @@ LeafletMapCoordSys.create = function (ecModel, api) {
6591465913

6591565914
ecModel.eachComponent('LeafletMap', function (LeafletMapModel) {
6591665915
var leafletMap = _echarts2["default"].leafletMap;
65917-
coordSys = new LeafletMapCoordSys(leafletMap, api);
65918-
coordSys.setMapOffset(LeafletMapModel.__mapOffset || [0, 0]);
65919-
LeafletMapModel.coordinateSystem = coordSys;
65916+
if (!coordSys) {
65917+
coordSys = new LeafletMapCoordSys(leafletMap, api);
65918+
}
65919+
LeafletMapModel.coordinateSystem = coordSys || new LeafletMapCoordSys(_echarts2["default"].leafletMap);
65920+
LeafletMapModel.coordinateSystem.setMapOffset(LeafletMapModel.__mapOffset || [0, 0]);
6592065921
});
6592165922
ecModel.eachSeries(function (seriesModel) {
6592265923
if (seriesModel.get('coordinateSystem') === 'leaflet') {
65923-
seriesModel.coordinateSystem = coordSys;
65924+
seriesModel.coordinateSystem = coordSys || new LeafletMapCoordSys(_echarts2["default"].leafletMap);
6592465925
}
6592565926
});
6592665927
};
65927-
6592865928
var echartsLayer = exports.echartsLayer = function echartsLayer(echartsOptions, options) {
6592965929
return new EchartsLayer(echartsOptions, options);
6593065930
};
@@ -71080,7 +71080,7 @@ module.exports = function (proj4) {
7108071080
/* 377 */
7108171081
/***/ (function(module) {
7108271082

71083-
module.exports = {"_args":[["proj4@2.3.15","G:\\iClient9"]],"_from":"proj4@2.3.15","_id":"proj4@2.3.15","_inBundle":false,"_integrity":"sha1-WtBui8owvg/6OJpJ5FZfUfBtCJ4=","_location":"/proj4","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"proj4@2.3.15","name":"proj4","escapedName":"proj4","rawSpec":"2.3.15","saveSpec":null,"fetchSpec":"2.3.15"},"_requiredBy":["/"],"_resolved":"http://registry.npm.taobao.org/proj4/download/proj4-2.3.15.tgz","_spec":"2.3.15","_where":"G:\\iClient9","author":"","bugs":{"url":"https://github.com/proj4js/proj4js/issues"},"contributors":[{"name":"Mike Adair","email":"madair@dmsolutions.ca"},{"name":"Richard Greenwood","email":"rich@greenwoodmap.com"},{"name":"Calvin Metcalf","email":"calvin.metcalf@gmail.com"},{"name":"Richard Marsden","url":"http://www.winwaed.com"},{"name":"T. Mittan"},{"name":"D. Steinwand"},{"name":"S. Nelson"}],"dependencies":{"mgrs":"~0.0.2"},"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"browserify":"~12.0.1","chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-browserify":"~4.0.1","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","istanbul":"~0.2.4","mocha":"~1.17.1","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"homepage":"https://github.com/proj4js/proj4js#readme","jam":{"main":"dist/proj4.js","include":["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},"license":"MIT","main":"lib/index.js","name":"proj4","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"test":"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},"version":"2.3.15"};
71083+
module.exports = {"_args":[["proj4@2.3.15","E:\\git\\iClient9"]],"_from":"proj4@2.3.15","_id":"proj4@2.3.15","_inBundle":false,"_integrity":"sha1-WtBui8owvg/6OJpJ5FZfUfBtCJ4=","_location":"/proj4","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"proj4@2.3.15","name":"proj4","escapedName":"proj4","rawSpec":"2.3.15","saveSpec":null,"fetchSpec":"2.3.15"},"_requiredBy":["/"],"_resolved":"http://registry.npm.taobao.org/proj4/download/proj4-2.3.15.tgz","_spec":"2.3.15","_where":"E:\\git\\iClient9","author":"","bugs":{"url":"https://github.com/proj4js/proj4js/issues"},"contributors":[{"name":"Mike Adair","email":"madair@dmsolutions.ca"},{"name":"Richard Greenwood","email":"rich@greenwoodmap.com"},{"name":"Calvin Metcalf","email":"calvin.metcalf@gmail.com"},{"name":"Richard Marsden","url":"http://www.winwaed.com"},{"name":"T. Mittan"},{"name":"D. Steinwand"},{"name":"S. Nelson"}],"dependencies":{"mgrs":"~0.0.2"},"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"browserify":"~12.0.1","chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-browserify":"~4.0.1","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","istanbul":"~0.2.4","mocha":"~1.17.1","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"homepage":"https://github.com/proj4js/proj4js#readme","jam":{"main":"dist/proj4.js","include":["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},"license":"MIT","main":"lib/index.js","name":"proj4","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"test":"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},"version":"2.3.15"};
7108471084

7108571085
/***/ }),
7108671086
/* 378 */

dist/iclient9-leaflet.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-leaflet.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/leaflet/overlay/EChartsLayer.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,10 @@ export var EchartsLayer = L.Layer.extend({
210210
* @param LeafletMap - {L.map} 地图
211211
* @param api - {Object} 接口
212212
*/
213-
export function LeafletMapCoordSys(LeafletMap, api) {
213+
export function LeafletMapCoordSys(LeafletMap) {
214214
this._LeafletMap = LeafletMap;
215215
this.dimensions = ['lng', 'lat'];
216216
this._mapOffset = [0, 0];
217-
this._api = api
218217
}
219218

220219
LeafletMapCoordSys.prototype.dimensions = ['lng', 'lat'];
@@ -291,8 +290,8 @@ LeafletMapCoordSys.prototype.pointToData = function (pt) {
291290
};
292291

293292
LeafletMapCoordSys.prototype.getViewRect = function () {
294-
var api = this._api;
295-
return new echarts.graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());
293+
const size = this._LeafletMap.getSize();
294+
return new echarts.graphic.BoundingRect(0, 0, size.x, size.y);
296295
};
297296

298297
LeafletMapCoordSys.prototype.getRoamTransform = function () {
@@ -305,17 +304,18 @@ LeafletMapCoordSys.create = function (ecModel, api) {
305304

306305
ecModel.eachComponent('LeafletMap', function (LeafletMapModel) {
307306
var leafletMap = echarts.leafletMap;
308-
coordSys = new LeafletMapCoordSys(leafletMap, api);
309-
coordSys.setMapOffset(LeafletMapModel.__mapOffset || [0, 0]);
310-
LeafletMapModel.coordinateSystem = coordSys;
307+
if (!coordSys) {
308+
coordSys = new LeafletMapCoordSys(leafletMap, api);
309+
}
310+
LeafletMapModel.coordinateSystem = coordSys || new LeafletMapCoordSys(echarts.leafletMap);
311+
LeafletMapModel.coordinateSystem.setMapOffset(LeafletMapModel.__mapOffset || [0, 0]);
311312
});
312313
ecModel.eachSeries(function (seriesModel) {
313314
if (seriesModel.get('coordinateSystem') === 'leaflet') {
314-
seriesModel.coordinateSystem = coordSys
315+
seriesModel.coordinateSystem = coordSys || new LeafletMapCoordSys(echarts.leafletMap);
315316
}
316317
})
317318
};
318-
319319
export var echartsLayer = function (echartsOptions, options) {
320320
return new EchartsLayer(echartsOptions, options);
321321
};

0 commit comments

Comments
 (0)