mirror of https://gitee.com/antv-l7/antv-l7
feat: 发布打包代码调整 (#1117)
* fix: 修复 mouseup 失效 * chore: update version 2.8.35 -> 2.8.36 * fix: fix bboxPolygon conflict * fix: fix bboxPolygon conflict * feat: add utils turf dependencies * fix: change rollup build config * feat: 替换 turf/bbox-polygon 的引入方式 * feat: add turf bboxpolygon dependencies * feat: change TileLoadParams interface export * style: lint style * feat: change TilesetManagerOptions interface export * style: lint style * feat: rename tilebboxPolygon -> bboxPolygon * feat: rename tilebboxPolygon -> bboxPolygon * fix: 解决 rollup 打包问题 Co-authored-by: yunji <yunji.me@outlook.com>
This commit is contained in:
parent
2b9c850183
commit
00005f1147
15
lerna.json
15
lerna.json
|
@ -1,14 +1,21 @@
|
|||
{
|
||||
"packages": ["packages/*"],
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"command": {
|
||||
"publish": {
|
||||
"ignoreChanges": ["*.md"],
|
||||
"allowBranch": ["publish", "docs"],
|
||||
"ignoreChanges": [
|
||||
"*.md"
|
||||
],
|
||||
"allowBranch": [
|
||||
"publish",
|
||||
"docs"
|
||||
],
|
||||
"message": "chore: publish",
|
||||
"registry": "https://registry.npmjs.org"
|
||||
}
|
||||
},
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-component",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -25,8 +25,8 @@
|
|||
"author": "lzxue",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"inversify": "^5.0.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-core",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -24,7 +24,7 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/async-hook": "^2.1.0",
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"ajv": "^6.10.2",
|
||||
"element-resize-event": "^3.0.3",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "A Large-scale WebGL-powered Geospatial Data Visualization",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -25,13 +25,13 @@
|
|||
"author": "antv",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@antv/l7-component": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-layers": "^2.8.35",
|
||||
"@antv/l7-maps": "^2.8.35",
|
||||
"@antv/l7-scene": "^2.8.35",
|
||||
"@antv/l7-source": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-component": "^2.8.36",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@antv/l7-layers": "^2.8.36",
|
||||
"@antv/l7-maps": "^2.8.36",
|
||||
"@antv/l7-scene": "^2.8.36",
|
||||
"@antv/l7-source": "^2.8.36",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7"
|
||||
},
|
||||
"gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31",
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
const version = '2.8.35';
|
||||
const version = '2.8.36';
|
||||
export { version };
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-layers",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "L7's collection of built-in layers",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -23,9 +23,9 @@
|
|||
"author": "xiaoiver",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-source": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@antv/l7-source": "^2.8.36",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@mapbox/martini": "^0.2.0",
|
||||
"@turf/meta": "^6.0.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-map",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "l7 map",
|
||||
"keywords": [],
|
||||
"author": "thinkinggis <lzx199065@gmail.com>",
|
||||
|
@ -37,7 +37,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/antvis/L7#readme",
|
||||
"dependencies": {
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@mapbox/point-geometry": "^0.1.0",
|
||||
"@mapbox/unitbezier": "^0.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-maps",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -27,9 +27,9 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@amap/amap-jsapi-loader": "^0.0.3",
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-map": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@antv/l7-map": "^2.8.36",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@types/amap-js-api": "^1.4.6",
|
||||
"@types/mapbox-gl": "^1.11.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-mini",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "A Large-scale WebGL-powered Geospatial Data Visualization",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -25,11 +25,11 @@
|
|||
"author": "antv",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-layers": "^2.8.35",
|
||||
"@antv/l7-maps": "^2.8.35",
|
||||
"@antv/l7-scene": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@antv/l7-layers": "^2.8.36",
|
||||
"@antv/l7-maps": "^2.8.36",
|
||||
"@antv/l7-scene": "^2.8.36",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7"
|
||||
},
|
||||
"gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-renderer",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -26,7 +26,7 @@
|
|||
"gl": "^4.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"inversify": "^5.0.1",
|
||||
"l7regl": "^0.0.20",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-scene",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -23,12 +23,12 @@
|
|||
"author": "xiaoiver",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/l7-component": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-layers": "^2.8.35",
|
||||
"@antv/l7-maps": "^2.8.35",
|
||||
"@antv/l7-renderer": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-component": "^2.8.36",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@antv/l7-layers": "^2.8.36",
|
||||
"@antv/l7-maps": "^2.8.36",
|
||||
"@antv/l7-renderer": "^2.8.36",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"inversify": "^5.0.1",
|
||||
"mapbox-gl": "^1.2.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-source",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -26,8 +26,8 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/async-hook": "^2.1.0",
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-utils": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@antv/l7-utils": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@mapbox/geojson-rewind": "^0.4.0",
|
||||
"@turf/helpers": "^6.1.4",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-three",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "three for L7 ",
|
||||
"keywords": [
|
||||
"3D",
|
||||
|
@ -44,9 +44,9 @@
|
|||
},
|
||||
"homepage": "https://github.com/antvis/L7#readme",
|
||||
"dependencies": {
|
||||
"@antv/l7-core": "^2.8.35",
|
||||
"@antv/l7-layers": "^2.8.35",
|
||||
"@antv/l7-scene": "^2.8.35",
|
||||
"@antv/l7-core": "^2.8.36",
|
||||
"@antv/l7-layers": "^2.8.36",
|
||||
"@antv/l7-scene": "^2.8.36",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"inversify": "^5.0.1",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-utils",
|
||||
"version": "2.8.35",
|
||||
"version": "2.8.36",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -25,6 +25,7 @@
|
|||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@turf/helpers": "^6.1.4",
|
||||
"@turf/bbox-polygon": "^6.5.0",
|
||||
"d3-color": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { Bounds, UpdateTileStrategy } from './types';
|
||||
import { TileBounds, UpdateTileStrategy } from './types';
|
||||
import {
|
||||
updateTileStateOverlap,
|
||||
updateTileStateReplace,
|
||||
} from './utils/strategies';
|
||||
|
||||
export const TILE_SIZE = 256;
|
||||
export const DEFAULT_EXTENT: Bounds = [
|
||||
export const DEFAULT_EXTENT: TileBounds = [
|
||||
-Infinity,
|
||||
-Infinity,
|
||||
Infinity,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
export * from './utils/tile-url';
|
||||
export { Tile, TileLoadParams } from './tile';
|
||||
export { TilesetManager, TilesetManagerOptions } from './tileset-manager';
|
||||
export * from './types';
|
||||
export { Tile } from './tile';
|
||||
export { TilesetManager } from './tileset-manager';
|
||||
|
|
|
@ -1,27 +1,12 @@
|
|||
import { bboxPolygon } from '@turf/turf';
|
||||
import { Bounds } from './types';
|
||||
import bboxPolygon from '@turf/bbox-polygon';
|
||||
import {
|
||||
LoadTileDataStatus,
|
||||
TileBounds,
|
||||
TileLoadDataOptions,
|
||||
TileOptions,
|
||||
} from './types';
|
||||
import { getTileWarpXY, tileToBounds } from './utils/lonlat-tile';
|
||||
|
||||
type TileOptions = { x: number; y: number; z: number; tileSize: number };
|
||||
|
||||
export type TileLoadParams = TileOptions & {
|
||||
bounds: Bounds;
|
||||
signal: AbortSignal;
|
||||
};
|
||||
|
||||
type TileLoadDataOptions = {
|
||||
getData: (tile: TileLoadParams) => Promise<any>;
|
||||
onLoad: (tile: Tile) => void;
|
||||
onError: (error: Error, tile: Tile) => void;
|
||||
};
|
||||
|
||||
enum LoadTileDataStatus {
|
||||
Loading = 'Loading',
|
||||
Loaded = 'Loaded',
|
||||
Failure = 'Failure',
|
||||
Cancelled = 'Cancelled',
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个瓦片
|
||||
* 负责瓦片数据加载、缓存数据、缓存图层
|
||||
|
@ -98,7 +83,7 @@ export class Tile {
|
|||
const [minLng, minLat, maxLng, maxLat] = this.bounds;
|
||||
const center = [(maxLng - minLng) / 2, (maxLat - minLat) / 2] as const;
|
||||
|
||||
const polygon = bboxPolygon(this.bounds as Bounds, {
|
||||
const polygon = bboxPolygon(this.bounds as TileBounds, {
|
||||
properties: {
|
||||
key: this.key,
|
||||
bbox: this.bounds,
|
||||
|
@ -158,7 +143,7 @@ export class Tile {
|
|||
// 如果请求出错或数据为空
|
||||
if (error || !tileData) {
|
||||
this.loadStatus = LoadTileDataStatus.Failure;
|
||||
onError(error, this);
|
||||
onError(error as Error, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,20 +5,10 @@ import {
|
|||
NOOP,
|
||||
UPDATE_TILE_STRATEGIES,
|
||||
} from './const';
|
||||
import { Tile, TileLoadParams } from './tile';
|
||||
import { Bounds, UpdateTileStrategy } from './types';
|
||||
import { Tile } from './tile';
|
||||
import { TilesetManagerOptions, UpdateTileStrategy } from './types';
|
||||
import { getTileIndices } from './utils/lonlat-tile';
|
||||
|
||||
export type TilesetManagerOptions = {
|
||||
tileSize: number;
|
||||
zoomOffset: number;
|
||||
minZoom: number;
|
||||
maxZoom: number;
|
||||
extent: Bounds;
|
||||
getTileData: (tile: TileLoadParams) => any;
|
||||
updateStrategy: UpdateTileStrategy | ((tiles: Tile[]) => void);
|
||||
};
|
||||
|
||||
/**
|
||||
* 管理瓦片数据
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { Tile } from './tile';
|
||||
|
||||
// Bounds [minLng, minLat, maxLng, maxLat]
|
||||
export type Bounds = [number, number, number, number];
|
||||
export type TileBounds = [number, number, number, number];
|
||||
|
||||
// 瓦片更新显示策略
|
||||
export enum UpdateTileStrategy {
|
||||
|
@ -8,3 +10,33 @@ export enum UpdateTileStrategy {
|
|||
// 全部替换策略
|
||||
Replace = 'replace',
|
||||
}
|
||||
|
||||
export type TileOptions = { x: number; y: number; z: number; tileSize: number };
|
||||
|
||||
export type TileLoadParams = TileOptions & {
|
||||
bounds: TileBounds;
|
||||
signal: AbortSignal;
|
||||
};
|
||||
|
||||
export type TileLoadDataOptions = {
|
||||
getData: (tile: TileLoadParams) => Promise<any>;
|
||||
onLoad: (tile: Tile) => void;
|
||||
onError: (error: Error, tile: Tile) => void;
|
||||
};
|
||||
|
||||
export enum LoadTileDataStatus {
|
||||
Loading = 'Loading',
|
||||
Loaded = 'Loaded',
|
||||
Failure = 'Failure',
|
||||
Cancelled = 'Cancelled',
|
||||
}
|
||||
|
||||
export type TilesetManagerOptions = {
|
||||
tileSize: number;
|
||||
zoomOffset: number;
|
||||
minZoom: number;
|
||||
maxZoom: number;
|
||||
extent: TileBounds;
|
||||
getTileData: (tile: TileLoadParams) => any;
|
||||
updateStrategy: UpdateTileStrategy | ((tiles: Tile[]) => void);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { DEFAULT_EXTENT } from '../const';
|
||||
import { Bounds } from '../types';
|
||||
import { TileBounds } from '../types';
|
||||
|
||||
// // https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#ECMAScript_.28JavaScript.2FActionScript.2C_etc..29
|
||||
export function osmLonLat2TileXY(lon: number, lat: number, zoom: number) {
|
||||
|
@ -30,7 +30,7 @@ export function osmTileXY2LonLat(x: number, y: number, zoom: number) {
|
|||
export const tileToBounds = (x: number, y: number, z: number) => {
|
||||
const [minLng, maxLat] = osmTileXY2LonLat(x, y, z);
|
||||
const [maxLng, minLat] = osmTileXY2LonLat(x + 1, y + 1, z);
|
||||
return [minLng, minLat, maxLng, maxLat] as Bounds;
|
||||
return [minLng, minLat, maxLng, maxLat] as TileBounds;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -49,11 +49,11 @@ export function getTileIndices({
|
|||
extent = DEFAULT_EXTENT,
|
||||
}: {
|
||||
zoom: number;
|
||||
latLonBounds: Bounds;
|
||||
latLonBounds: TileBounds;
|
||||
maxZoom: number;
|
||||
minZoom: number;
|
||||
zoomOffset: number;
|
||||
extent: Bounds;
|
||||
extent: TileBounds;
|
||||
tileSize: number;
|
||||
}) {
|
||||
let z = Math.ceil(zoom) + zoomOffset;
|
||||
|
|
Loading…
Reference in New Issue