diff --git a/packages/layers/src/point/models/text.ts b/packages/layers/src/point/models/text.ts index 8c49331a97..e9b08eaf9a 100644 --- a/packages/layers/src/point/models/text.ts +++ b/packages/layers/src/point/models/text.ts @@ -104,6 +104,7 @@ export default class TextModel extends BaseModel { } public buildModels(): IModel[] { + this.extent = this.textExtent(); this.initGlyph(); this.updateTexture(); this.filterGlyphs(); diff --git a/packages/source/src/source.ts b/packages/source/src/source.ts index c7db82343f..39d12da00e 100644 --- a/packages/source/src/source.ts +++ b/packages/source/src/source.ts @@ -137,6 +137,7 @@ export default class Source extends EventEmitter { public getFeatureById(id: number): unknown { const { type = 'geojson' } = this.parser; if (type === 'geojson' && !this.cluster) { + // TODO: 聚合图层返回聚合和后的数据 return id < this.rawData.features.length ? this.rawData.features[id] : 'null'; diff --git a/packages/source/src/transform/hexagon.ts b/packages/source/src/transform/hexagon.ts index d62519ee6e..3478e70eb0 100644 --- a/packages/source/src/transform/hexagon.ts +++ b/packages/source/src/transform/hexagon.ts @@ -20,7 +20,7 @@ interface IRawData { } export function pointToHexbin(data: IParserData, option: ITransform) { const dataArray = data.dataArray; - const { size = 10 } = option; + const { size = 10, method = 'sum' } = option; const pixlSize = ((size / (2 * Math.PI * R_EARTH)) * (256 << 20)) / 2; const screenPoints: IRawData[] = dataArray.map((point: IParseDataItem) => { const [x, y] = aProjectFlat(point.coordinates); @@ -38,12 +38,12 @@ export function pointToHexbin(data: IParserData, option: ITransform) { const result: IParserData = { dataArray: hexbinBins.map((hex: IHexBinItem, index: number) => { - if (option.field && option.method) { + if (option.field && method) { const columns = getColumn(hex, option.field); - hex[option.method] = statMap[option.method](columns); + hex[method] = statMap[method](columns); } return { - [option.method]: hex[option.method], + [option.method]: hex[method], count: hex.length, coordinates: [hex.x, hex.y], _id: index + 1, diff --git a/packages/source/src/transform/join.ts b/packages/source/src/transform/join.ts index 023b1e74c4..f5846a1156 100644 --- a/packages/source/src/transform/join.ts +++ b/packages/source/src/transform/join.ts @@ -14,7 +14,7 @@ export function join(geoData: IParserData, options: { [key: string]: any }) { const { field, data } = options; const dataObj: { [key: string]: any } = {}; data.forEach((element: { [key: string]: any }) => { - dataObj[element.field] = element; + dataObj[element[field]] = element; }); geoData.dataArray = data.dataArray.map((item: IParseDataItem) => { const joinName = item[field]; diff --git a/stories/Layers/components/Text.tsx b/stories/Layers/components/Text.tsx index 14868ababa..eb16844c3e 100644 --- a/stories/Layers/components/Text.tsx +++ b/stories/Layers/components/Text.tsx @@ -43,6 +43,7 @@ export default class TextLayerDemo extends React.Component { .size(12) .color('#fff') .style({ + textAllowOverlap: true, // fontWeight: 200, // textAnchor: 'center', // 文本相对锚点的位置 center|left|right|top|bottom|top-left // textOffset: [0, 0], // 文本相对锚点的偏移量 [水平, 垂直]