chore: update version

This commit is contained in:
thinkinggis 2020-09-09 20:06:53 +08:00
parent 227a3368d5
commit 96729b995c
5 changed files with 21 additions and 9 deletions

View File

@ -62,7 +62,10 @@ export interface ISource {
cluster: boolean;
clusterOptions: Partial<IClusterOptions>;
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;

View File

@ -1,2 +1,2 @@
const version = '2.2.35';
const version = '2.2.36';
export { version };

View File

@ -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', () => {

View File

@ -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) {

View File

@ -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]]];
}
return [
[b1[0], b1[1]],
[b1[2], b1[3]],
];
}