Merge branch 'master' into fix_map_dependencies

This commit is contained in:
thinkinggis 2020-09-07 15:32:32 +08:00
commit 19daa4d5c5
26 changed files with 631 additions and 718 deletions

View File

@ -40,11 +40,11 @@ module.exports = api => {
return {
presets: [
[
'@babel/env',
'@babel/preset-env',
{
// https://babeljs.io/docs/en/babel-preset-env#usebuiltins
// useBuiltIns: 'usage',
...isCDNBundle ? { corejs: '3.0.0' } : {},
...isCDNBundle ? { corejs: 3 } : {},
useBuiltIns: isCDNBundle ? 'usage' : false,
// set `modules: false` when building CDN bundle, let rollup do commonjs works
// @see https://github.com/rollup/rollup-plugin-babel#modules

View File

@ -14,7 +14,7 @@
"message": "chore: publish"
}
},
"version": "2.2.34",
"version": "2.2.35",
"npmClient": "yarn",
"useWorkspaces": true,
"publishConfig": {

View File

@ -7,7 +7,7 @@
},
"devDependencies": {
"@antv/g2": "^3.5.9",
"@antv/gatsby-theme-antv": "^0.11.5",
"@antv/gatsby-theme-antv": "^0.10.71",
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-decorators": "^7.6.0",
@ -50,7 +50,7 @@
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"babel-plugin-transform-node-env-inline": "^0.4.3",
"babel-plugin-transform-postcss": "^0.3.0",
"babel-preset-gatsby": "^0.4.1",
"babel-preset-gatsby": "^0.5.8",
"babel-template": "^6.26.0",
"clean-webpack-plugin": "^3.0.0",
"commitizen": "^4.0.3",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-district",
"version": "2.2.34",
"version": "2.2.35",
"description": "L7 district moudules",
"keywords": [],
"author": "thinkinggis <lzx199065@gmail.com>",
@ -35,7 +35,7 @@
"sync": "tnpm sync"
},
"dependencies": {
"@antv/l7": "^2.2.34",
"@antv/l7": "2.2.35",
"@babel/runtime": "^7.7.7",
"@turf/circle": "^6.0.1",
"@turf/distance": "^6.0.1",

View File

@ -36,6 +36,7 @@ export default class BaseLayer extends EventEmitter {
protected options: IDistrictLayerOption;
protected layers: ILayer[] = [];
protected fillData: any;
protected bubbleData: any;
private popup: IPopup;
constructor(scene: Scene, option: Partial<IDistrictLayerOption> = {}) {
@ -87,6 +88,23 @@ export default class BaseLayer extends EventEmitter {
},
],
});
// 气泡图也需要更新
if (this.bubbleLayer) {
this.bubbleLayer.setData(this.bubbleData, {
transforms:
data.length === 0
? []
: [
{
type: 'join',
sourceField: joinBy[1], // data1 对应字段名
targetField: joinBy[0], // data 对应字段名 绑定到的地理数据
data,
},
],
});
}
}
protected async fetchData(data: { url: any; type: string }) {
if (data.type === 'pbf') {
@ -215,6 +233,8 @@ export default class BaseLayer extends EventEmitter {
center: [feature.properties.x, feature.properties.y],
};
});
this.bubbleData = labeldata;
this.addBubbleLayer(labeldata);
}
if (popup.enable) {

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-component",
"version": "2.2.34",
"version": "2.2.35",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,8 +25,8 @@
"author": "lzxue",
"license": "ISC",
"dependencies": {
"@antv/l7-core": "^2.2.34",
"@antv/l7-utils": "^2.2.34",
"@antv/l7-core": "2.2.35",
"@antv/l7-utils": "2.2.35",
"@babel/runtime": "^7.7.7",
"eventemitter3": "^4.0.0",
"inversify": "^5.0.1",

View File

@ -4,6 +4,7 @@ import {
IMarkerOption,
IPoint,
IPopup,
ISceneService,
TYPES,
} from '@antv/l7-core';
import {
@ -22,6 +23,7 @@ export default class Marker extends EventEmitter {
private defaultMarker: boolean;
private popup: IPopup;
private mapsService: IMapService<unknown>;
private sceneSerive: ISceneService;
private lngLat: ILngLat;
private scene: Container;
private added: boolean = false;
@ -49,7 +51,9 @@ export default class Marker extends EventEmitter {
// this.remove();
this.scene = scene;
this.mapsService = scene.get<IMapService>(TYPES.IMapService);
this.sceneSerive = scene.get<ISceneService>(TYPES.ISceneService);
const { element, draggable } = this.markerOption;
// this.sceneSerive.getSceneContainer().appendChild(element as HTMLElement);
this.mapsService.getMarkerContainer().appendChild(element as HTMLElement);
this.registerMarkerEvent(element as HTMLElement);
this.mapsService.on('camerachange', this.update);

View File

@ -197,7 +197,7 @@ export default class Popup extends EventEmitter implements IPopup {
if (!this.mapsService || !hasPosition || !this.content) {
return;
}
const popupContainer = this.sceneSerive.getSceneContainer();
const popupContainer = this.mapsService.getMarkerContainer();
if (!this.container && popupContainer) {
this.container = this.creatDom(
'div',
@ -213,11 +213,14 @@ export default class Popup extends EventEmitter implements IPopup {
.forEach((name) => this.container.classList.add(name));
}
// ['mousemove', 'mousedown', 'mouseup', 'click'].forEach((type) => {
// this.container.addEventListener(type, (e) => {
// e.stopPropagation();
// });
// });
// 高德地图需要阻止事件冒泡 // 测试mapbox 地图不需要添加
['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'].forEach(
(type) => {
this.container.addEventListener(type, (e) => {
e.stopPropagation();
});
},
);
}
if (maxWidth && this.container.style.maxWidth !== maxWidth) {
this.container.style.maxWidth = maxWidth;

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-core",
"version": "2.2.34",
"version": "2.2.35",
"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.2.34",
"@antv/l7-utils": "2.2.35",
"@babel/runtime": "^7.7.7",
"@mapbox/tiny-sdf": "^1.1.1",
"ajv": "^6.10.2",

View File

@ -14,6 +14,7 @@ export interface ISceneService {
getSceneConfig(): Partial<ISceneConfig>;
render(): void;
getSceneContainer(): HTMLDivElement;
getMarkerContainer(): HTMLElement;
exportPng(type?: 'png' | 'jpg'): string;
destroy(): void;
}

View File

@ -102,6 +102,8 @@ export default class Scene extends EventEmitter implements ISceneService {
private canvas: HTMLCanvasElement;
private markerContainer: HTMLElement;
private hooks: {
init: AsyncParallelHook;
};
@ -171,8 +173,12 @@ export default class Scene extends EventEmitter implements ISceneService {
const $container = createRendererContainer(
this.configService.getSceneConfig(this.id).id || '',
);
// 添加marker container;
this.$container = $container;
// this.addMarkerContainer();
if ($container) {
this.canvas = DOM.create('canvas', '', $container) as HTMLCanvasElement;
this.setCanvas();
@ -261,6 +267,22 @@ export default class Scene extends EventEmitter implements ISceneService {
return this.configService.getSceneConfig(this.id as string);
}
public addMarkerContainer(): void {
// @ts-ignore
const mapContainer = this.$container.parentElement as HTMLElement;
if (mapContainer !== null) {
this.markerContainer = DOM.create(
'div',
'l7-marker-container',
mapContainer,
);
}
}
public getMarkerContainer() {
return this.markerContainer;
}
public destroy() {
if (!this.inited) {
this.destroyed = true;

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-draw",
"version": "2.2.34",
"version": "2.2.35",
"description": "L7 Draw moudules",
"keywords": [],
"author": "thinkinggis <lzx199065@gmail.com>",
@ -36,7 +36,7 @@
"sync": "tnpm sync"
},
"dependencies": {
"@antv/l7": "^2.2.34",
"@antv/l7": "2.2.35",
"@babel/runtime": "^7.7.7",
"@turf/circle": "^6.0.1",
"@turf/distance": "^6.0.1",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7",
"version": "2.2.34",
"version": "2.2.35",
"description": "A Large-scale WebGL-powered Geospatial Data Visualization",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,12 +25,12 @@
"author": "antv",
"license": "MIT",
"dependencies": {
"@antv/l7-component": "^2.2.34",
"@antv/l7-core": "^2.2.34",
"@antv/l7-layers": "^2.2.34",
"@antv/l7-maps": "^2.2.34",
"@antv/l7-scene": "^2.2.34",
"@antv/l7-utils": "^2.2.34",
"@antv/l7-component": "2.2.35",
"@antv/l7-core": "2.2.35",
"@antv/l7-layers": "2.2.35",
"@antv/l7-maps": "2.2.35",
"@antv/l7-scene": "2.2.35",
"@antv/l7-utils": "2.2.35",
"@babel/runtime": "^7.7.7"
},
"gitHead": "20154fe30d512024b03ac5e40f77731bc0580bb0",

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-layers",
"version": "2.2.34",
"version": "2.2.35",
"description": "L7's collection of built-in layers",
"main": "lib/index.js",
"module": "es/index.js",
@ -24,9 +24,9 @@
"license": "ISC",
"dependencies": {
"@antv/async-hook": "^2.1.0",
"@antv/l7-core": "^2.2.34",
"@antv/l7-source": "^2.2.34",
"@antv/l7-utils": "^2.2.34",
"@antv/l7-core": "2.2.35",
"@antv/l7-source": "2.2.35",
"@antv/l7-utils": "2.2.35",
"@babel/runtime": "^7.7.7",
"@mapbox/martini": "^0.2.0",
"@turf/meta": "^6.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-map",
"version": "2.2.34",
"version": "2.2.35",
"description": "l7 map",
"keywords": [],
"author": "thinkinggis <lzx199065@gmail.com>",
@ -37,7 +37,8 @@
},
"homepage": "https://github.com/antvis/L7#readme",
"dependencies": {
"@antv/l7-utils": "^2.2.34",
"@antv/l7-utils": "2.2.35",
"@babel/runtime": "^7.7.7",
"@mapbox/point-geometry": "^0.1.0",
"@mapbox/unitbezier": "^0.0.0",
"eventemitter3": "^4.0.4",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-maps",
"version": "2.2.34",
"version": "2.2.35",
"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.2.34",
"@antv/l7-map": "^2.2.34",
"@antv/l7-utils": "^2.2.34",
"@antv/l7-core": "2.2.35",
"@antv/l7-map": "2.2.35",
"@antv/l7-utils": "2.2.35",
"@babel/runtime": "^7.7.7",
"@types/amap-js-api": "^1.4.6",
"gl-matrix": "^3.1.0",

View File

@ -1,8 +1,8 @@
import { Map } from '@antv/l7-map';
import BaseMapWrapper from '../BaseMapWrapper';
import MapboxService from './map';
import MapService from './map';
export default class MapboxWrapper extends BaseMapWrapper<Map> {
protected getServiceConstructor() {
return MapboxService;
return MapService;
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-react",
"version": "2.2.34",
"version": "2.2.35",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,8 +25,8 @@
"author": "lzxue",
"license": "ISC",
"dependencies": {
"@antv/l7": "^2.2.34",
"@antv/l7-maps": "^2.2.34",
"@antv/l7": "2.2.35",
"@antv/l7-maps": "2.2.35",
"@babel/runtime": "^7.7.7",
"load-styles": "^2.0.0"
},

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-renderer",
"version": "2.2.34",
"version": "2.2.35",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -26,7 +26,7 @@
"gl": "^4.4.0"
},
"dependencies": {
"@antv/l7-core": "^2.2.34",
"@antv/l7-core": "2.2.35",
"@babel/runtime": "^7.7.7",
"inversify": "^5.0.1",
"lodash": "^4.17.15",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-scene",
"version": "2.2.34",
"version": "2.2.35",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -23,11 +23,11 @@
"author": "xiaoiver",
"license": "ISC",
"dependencies": {
"@antv/l7-component": "^2.2.34",
"@antv/l7-core": "^2.2.34",
"@antv/l7-maps": "^2.2.34",
"@antv/l7-renderer": "^2.2.34",
"@antv/l7-utils": "^2.2.34",
"@antv/l7-component": "2.2.35",
"@antv/l7-core": "2.2.35",
"@antv/l7-maps": "2.2.35",
"@antv/l7-renderer": "2.2.35",
"@antv/l7-utils": "2.2.35",
"@babel/runtime": "^7.7.7",
"inversify": "^5.0.1",
"mapbox-gl": "^1.2.1",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-source",
"version": "2.2.34",
"version": "2.2.35",
"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.2.34",
"@antv/l7-utils": "^2.2.34",
"@antv/l7-core": "2.2.35",
"@antv/l7-utils": "2.2.35",
"@babel/runtime": "^7.7.7",
"@mapbox/geojson-rewind": "^0.4.0",
"@turf/helpers": "^6.1.4",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-three",
"version": "2.2.34",
"version": "2.2.35",
"description": "three for L7 ",
"keywords": [
"3D",
@ -44,7 +44,7 @@
},
"homepage": "https://github.com/antvis/L7#readme",
"dependencies": {
"@antv/l7": "^2.2.34",
"@antv/l7": "2.2.35",
"@babel/runtime": "^7.7.7",
"rollup": "^2.3.3",
"rollup-plugin-less": "^1.1.2"

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-utils",
"version": "2.2.34",
"version": "2.2.35",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -195,6 +195,24 @@ export default class Country extends React.Component {
value: null,
},
];
const ProvinceData2 = [
{
name: '云南省',
code: 530000,
value: 178810.12,
},
{
name: '黑龙江省',
code: 230000,
value: 163610.62,
},
{
name: '贵州省',
code: 520000,
value: 148060.45,
},
];
scene.on('loaded', () => {
const Layer = new CountryLayer(scene, {
data: ProvinceData,
@ -204,7 +222,7 @@ export default class Country extends React.Component {
enable: true,
size: {
field: 'value',
values: [3, 20],
values: [8, 20],
},
},
popup: {
@ -214,6 +232,10 @@ export default class Country extends React.Component {
},
},
});
setTimeout(() => {
Layer.updateData(ProvinceData2);
}, 2000);
});
this.scene = scene;
}

1160
yarn.lock

File diff suppressed because it is too large Load Diff