This is an automated email from the ASF dual-hosted git repository. sushuang pushed a commit to branch release in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 65ead2bf5dec79fe96cc826a3a96f4d85848e906 Author: sushuang <[email protected]> AuthorDate: Wed Sep 12 16:31:44 2018 +0800 Fix map problem brought from geo upgrade. --- src/coord/geo/Geo.js | 13 ++++++------- src/coord/geo/geoCreator.js | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/coord/geo/Geo.js b/src/coord/geo/Geo.js index 8c6491c..bc8923a 100644 --- a/src/coord/geo/Geo.js +++ b/src/coord/geo/Geo.js @@ -33,8 +33,9 @@ import geoSourceManager from './geoSourceManager'; * Specify the positioned areas by left, top, width, height * @param {Object.<string, string>} [nameMap] * Specify name alias + * @param {boolean} [invertLongitute=true] */ -function Geo(name, map, nameMap) { +function Geo(name, map, nameMap, invertLongitute) { View.call(this, name); @@ -48,6 +49,7 @@ function Geo(name, map, nameMap) { this._nameCoordMap = source.nameCoordMap; this._regionsMap = source.nameCoordMap; + this._invertLongitute = invertLongitute == null ? true : invertLongitute; /** * @readOnly @@ -92,14 +94,11 @@ Geo.prototype = { */ transformTo: function (x, y, width, height) { var rect = this.getBoundingRect(); - - // FIXME - // Should not name it as invertLng. - var invertLng = this.invertLng; + var invertLongitute = this._invertLongitute; rect = rect.clone(); - if (invertLng) { + if (invertLongitute) { // Longitute is inverted rect.y = -rect.y - rect.height; } @@ -112,7 +111,7 @@ Geo.prototype = { rawTransformable.decomposeTransform(); - if (invertLng) { + if (invertLongitute) { var scale = rawTransformable.scale; scale[1] = -scale[1]; } diff --git a/src/coord/geo/geoCreator.js b/src/coord/geo/geoCreator.js index e740b65..73b3346 100644 --- a/src/coord/geo/geoCreator.js +++ b/src/coord/geo/geoCreator.js @@ -134,29 +134,28 @@ var geoCreator = { // FIXME Create each time may be slow ecModel.eachComponent('geo', function (geoModel, idx) { var name = geoModel.get('map'); - var geo = new Geo(name + idx, name, geoModel.get('nameMap')); - geo.zoomLimit = geoModel.get('scaleLimit'); - geoList.push(geo); - - setGeoCoords(geo, geoModel); - - geoModel.coordinateSystem = geo; - geo.model = geoModel; - - // FIXME ??? var aspectScale = geoModel.get('aspectScale'); - var invertLng = true; + var invertLongitute = true; var mapRecords = mapDataStorage.retrieveMap(name); if (mapRecords && mapRecords[0] && mapRecords[0].type === 'svg') { aspectScale == null && (aspectScale = 1); - invertLng = false; + invertLongitute = false; } else { aspectScale == null && (aspectScale = 0.75); } + + var geo = new Geo(name + idx, name, geoModel.get('nameMap'), invertLongitute); + geo.aspectScale = aspectScale; - geo.invertLng = invertLng; + geo.zoomLimit = geoModel.get('scaleLimit'); + geoList.push(geo); + + setGeoCoords(geo, geoModel); + + geoModel.coordinateSystem = geo; + geo.model = geoModel; // Inject resize method geo.resize = resizeGeo; @@ -196,6 +195,7 @@ var geoCreator = { // Inject resize method geo.resize = resizeGeo; + geo.aspectScale = mapSeries[0].get('aspectScale'); geo.resize(mapSeries[0], api); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
