From 96729b995c51cf46ba95234ed6f266249159e34e Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Wed, 9 Sep 2020 20:06:53 +0800 Subject: [PATCH] chore: update version --- packages/core/src/services/source/ISourceService.ts | 5 ++++- packages/l7/src/version.ts | 2 +- packages/source/__tests__/source.spec.ts | 2 +- packages/source/src/source.ts | 12 +++++++++--- packages/utils/src/geo.ts | 9 ++++++--- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/core/src/services/source/ISourceService.ts b/packages/core/src/services/source/ISourceService.ts index 1e9dc25e2b..8ce5b4f596 100644 --- a/packages/core/src/services/source/ISourceService.ts +++ b/packages/core/src/services/source/ISourceService.ts @@ -62,7 +62,10 @@ export interface ISource { cluster: boolean; clusterOptions: Partial; setData(data: any): void; - updateClusterData(bbox: [[number, number], [number, number]], zoom: number): void; + updateClusterData( + bbox: [[number, number], [number, number]], + zoom: number, + ): void; getFeatureById(id: number): unknown; getFeatureId(field: string, value: any): number | undefined; getClusters(zoom: number): any; diff --git a/packages/l7/src/version.ts b/packages/l7/src/version.ts index eb2ea4e452..fea363830e 100644 --- a/packages/l7/src/version.ts +++ b/packages/l7/src/version.ts @@ -1,2 +1,2 @@ -const version = '2.2.35'; +const version = '2.2.36'; export { version }; diff --git a/packages/source/__tests__/source.spec.ts b/packages/source/__tests__/source.spec.ts index d6bfdbd0bb..9875d9a76a 100644 --- a/packages/source/__tests__/source.spec.ts +++ b/packages/source/__tests__/source.spec.ts @@ -1,7 +1,7 @@ +import { bBoxToBounds } from '@antv/l7-utils'; import Source from '../src/source'; import Point from './data/point'; import Polygon from './data/polygon'; -import { bBoxToBounds } from '@antv/l7-utils'; describe('source constructor', () => { it('source.constructor', () => { diff --git a/packages/source/src/source.ts b/packages/source/src/source.ts index 76d05d23b7..07ab18d001 100644 --- a/packages/source/src/source.ts +++ b/packages/source/src/source.ts @@ -11,7 +11,7 @@ import { lazyInject, TYPES, } from '@antv/l7-core'; -import { extent, boundsContains, bBoxToBounds } from '@antv/l7-utils'; +import { bBoxToBounds, boundsContains, extent } from '@antv/l7-utils'; import { BBox, Feature, @@ -85,12 +85,18 @@ export default class Source extends EventEmitter { public getClustersLeaves(id: number): any { return this.clusterIndex.getLeaves(id, Infinity); } - public updateClusterData(bbox: [[number,number],[number,number]],zoom: number): void { + public updateClusterData( + bbox: [[number, number], [number, number]], + zoom: number, + ): void { const { method = 'sum', field } = this.clusterOptions; if (!boundsContains(bbox, bBoxToBounds(this.extent))) { return; } - let data = this.clusterIndex.getClusters(bbox[0].concat(bbox[1]), Math.floor(zoom)); + let data = this.clusterIndex.getClusters( + bbox[0].concat(bbox[1]), + Math.floor(zoom), + ); this.clusterOptions.zoom = zoom; data.forEach((p: any) => { if (!p.id) { diff --git a/packages/utils/src/geo.ts b/packages/utils/src/geo.ts index 806a95900a..36cf05c4e3 100644 --- a/packages/utils/src/geo.ts +++ b/packages/utils/src/geo.ts @@ -242,8 +242,11 @@ export function boundsContains(b1: IBounds, b2: IBounds): boolean { /** * bbox 转换为Bounds * @param b1 bbox - * + * */ export function bBoxToBounds(b1: BBox): IBounds { - return [[b1[0], b1[1]], [b1[2], b1[3]]]; -} \ No newline at end of file + return [ + [b1[0], b1[1]], + [b1[2], b1[3]], + ]; +}