diff --git a/src/core/source.js b/src/core/source.js index 4dff328e8b..ce6432c766 100644 --- a/src/core/source.js +++ b/src/core/source.js @@ -1,7 +1,7 @@ import Base from './base'; import Controller from './controller/index'; import { getTransform, getParser } from '../source'; -import { extent } from '../util/geo'; +import { extent, tranfrormCoord } from '../util/geo'; import { getMap } from '../map/index'; export default class Source extends Base { getDefaultCfg() { @@ -47,7 +47,8 @@ export default class Source extends Base { } _projectCoords() { this.data.dataArray.forEach(data => { - data.coordinates = this._coordProject(data.coordinates); + // data.coordinates = this._coordProject(data.coordinates); + data.coordinates = tranfrormCoord(data.coordinates, this._coorConvert.bind(this)); }); } createScale(field) { diff --git a/src/layer/heatmapLayer.js b/src/layer/heatmapLayer.js index 203814e5b6..0a6931bfb2 100644 --- a/src/layer/heatmapLayer.js +++ b/src/layer/heatmapLayer.js @@ -57,7 +57,7 @@ export default class HeatMapLayer extends Layer { } afterRender() { - if (this.shapeType !== 'grid' || this.shapeType !== 'hexagon') { + if (this.shapeType !== 'grid' && this.shapeType !== 'hexagon') { updateIntensityPass(this); } } diff --git a/src/util/geo.js b/src/util/geo.js index 1830562536..dcdbf8e8d6 100644 --- a/src/util/geo.js +++ b/src/util/geo.js @@ -24,3 +24,16 @@ function calcExtent(extent, coords) { } return extent; } + +export function tranfrormCoord(data, cb) { + return transform(data, cb); +} +function transform(item, cb) { + if (Array.isArray(item[0])) { + return item.map(coord => { + return transform(coord, cb); + }); + } + return cb(item); + +}