From 38db4656bd7cf44eaf34946a806d77decebe50db Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Sat, 18 Jan 2020 23:16:56 +0800 Subject: [PATCH 1/4] chore: add buildmodels plugin --- .../core/src/services/layer/ILayerService.ts | 2 + packages/layers/src/citybuliding/building.ts | 8 +- packages/layers/src/core/BaseLayer.ts | 24 +- packages/layers/src/heatmap/index.ts | 22 +- packages/layers/src/image/index.ts | 10 +- packages/layers/src/index.ts | 8 + packages/layers/src/line/index.ts | 12 +- .../layers/src/plugins/DataMappingPlugin.ts | 2 +- .../layers/src/plugins/DataSourcePlugin.ts | 3 + .../layers/src/plugins/LayerModelPlugin.ts | 26 ++ .../layers/src/plugins/LayerStylePlugin.ts | 1 + packages/layers/src/point/index.ts | 10 +- packages/layers/src/polygon/index.ts | 10 +- packages/layers/src/raster/image.ts | 2 +- packages/layers/src/raster/index.ts | 10 +- packages/layers/src/raster/raster.ts | 44 +-- packages/layers/src/raster/raster2d.ts | 68 ++-- packages/maps/src/amap/index.ts | 4 +- packages/source/src/parser/geojson.ts | 6 + stories/Components/components/Zoom.tsx | 6 +- stories/Layers/components/Arcline.tsx | 3 + stories/Layers/components/HeatMap.tsx | 42 +-- yarn.lock | 309 +++++++++--------- 23 files changed, 353 insertions(+), 279 deletions(-) create mode 100644 packages/layers/src/plugins/LayerModelPlugin.ts diff --git a/packages/core/src/services/layer/ILayerService.ts b/packages/core/src/services/layer/ILayerService.ts index a2ac525aa6..e9fda0a895 100644 --- a/packages/core/src/services/layer/ILayerService.ts +++ b/packages/core/src/services/layer/ILayerService.ts @@ -109,6 +109,8 @@ export interface ILayer { setContainer(container: Container): void; setCurrentPickId(id: number | null): void; getCurrentPickId(): number | null; + prepareBuildModel(): void; + buildModels(): void; buildLayerModel( options: ILayerModelInitializationOptions & Partial, diff --git a/packages/layers/src/citybuliding/building.ts b/packages/layers/src/citybuliding/building.ts index cc1b30c082..02fb7ae7eb 100644 --- a/packages/layers/src/citybuliding/building.ts +++ b/packages/layers/src/citybuliding/building.ts @@ -4,6 +4,10 @@ import CityBuildModel from './models/build'; export default class CityBuildingLayer extends BaseLayer { public type: string = 'PolygonLayer'; + public buildModels() { + this.layerModel = new CityBuildModel(this); + this.models = this.layerModel.buildModels(); + } protected getConfigSchema() { return { @@ -16,10 +20,6 @@ export default class CityBuildingLayer extends BaseLayer { }, }; } - protected buildModels() { - this.layerModel = new CityBuildModel(this); - this.models = this.layerModel.buildModels(); - } protected getModelType(): string { return 'citybuilding'; diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index 8494eeef23..59b392d698 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -301,26 +301,30 @@ export default class BaseLayer extends EventEmitter // 触发 init 生命周期插件 this.hooks.init.call(); + this.hooks.afterInit.call(); + + // 触发初始化完成事件; + this.emit('inited'); + this.emit('added'); + return this; + } + /** + * Model初始化前需要更新Model样式 + */ + public prepareBuildModel() { this.inited = true; - // 更新 model 样式 this.updateLayerConfig({ ...(this.getDefaultConfig() as object), ...this.rawConfig, }); - this.hooks.afterInit.call(); + // 启动动画 const { animateOption } = this.getLayerConfig(); if (animateOption?.enable) { this.layerService.startAnimate(); this.aniamateStatus = true; } - this.buildModels(); - // 触发初始化完成事件; - this.emit('inited'); - this.emit('added'); - return this; } - public color( field: StyleAttributeField, values?: StyleAttributeOption, @@ -773,11 +777,11 @@ export default class BaseLayer extends EventEmitter return this.layerService.clock.getElapsedTime() - this.animateStartTime; } - protected getConfigSchema() { + public buildModels() { throw new Error('Method not implemented.'); } - protected buildModels() { + protected getConfigSchema() { throw new Error('Method not implemented.'); } diff --git a/packages/layers/src/heatmap/index.ts b/packages/layers/src/heatmap/index.ts index f5253f2318..86042d222d 100644 --- a/packages/layers/src/heatmap/index.ts +++ b/packages/layers/src/heatmap/index.ts @@ -6,6 +6,12 @@ interface IHeatMapLayerStyleOptions { } export default class HeatMapLayer extends BaseLayer { public type: string = 'HeatMapLayer'; + + public buildModels() { + const shape = this.getModelType(); + this.layerModel = new HeatMapModels[shape](this); + this.models = this.layerModel.buildModels(); + } protected getConfigSchema() { return { properties: { @@ -21,7 +27,15 @@ export default class HeatMapLayer extends BaseLayer { protected renderModels() { const shape = this.getModelType(); if (shape === 'heatmap') { - this.layerModel.render(); // 独立的渲染流程 + // if (this.layerModelNeedUpdate) { + // this.layerModel.buildModels(); + // this.buildModels(); + // this.layerModelNeedUpdate = false; + // } + if (this.layerModel) { + this.layerModel.render(); // 独立的渲染流程 + } + return this; } if (this.layerModelNeedUpdate) { @@ -35,12 +49,6 @@ export default class HeatMapLayer extends BaseLayer { ); return this; } - - protected buildModels() { - const shape = this.getModelType(); - this.layerModel = new HeatMapModels[shape](this); - this.models = this.layerModel.buildModels(); - } protected getModelType(): HeatMapModelType { const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute( 'shape', diff --git a/packages/layers/src/image/index.ts b/packages/layers/src/image/index.ts index dccec6301f..7aad124e61 100644 --- a/packages/layers/src/image/index.ts +++ b/packages/layers/src/image/index.ts @@ -5,6 +5,11 @@ interface IImageLayerStyleOptions { } export default class ImageLayer extends BaseLayer { public type: string = 'ImageLayer'; + public buildModels() { + const modelType = this.getModelType(); + this.layerModel = new ImageModels[modelType](this); + this.models = this.layerModel.buildModels(); + } protected getConfigSchema() { return { properties: { @@ -23,11 +28,6 @@ export default class ImageLayer extends BaseLayer { }; return defaultConfig[type]; } - protected buildModels() { - const modelType = this.getModelType(); - this.layerModel = new ImageModels[modelType](this); - this.models = this.layerModel.buildModels(); - } protected getModelType(): ImageModelType { return 'image'; diff --git a/packages/layers/src/index.ts b/packages/layers/src/index.ts index b9a487a8b1..0ee206820b 100644 --- a/packages/layers/src/index.ts +++ b/packages/layers/src/index.ts @@ -14,6 +14,7 @@ import DataMappingPlugin from './plugins/DataMappingPlugin'; import DataSourcePlugin from './plugins/DataSourcePlugin'; import FeatureScalePlugin from './plugins/FeatureScalePlugin'; import LayerAnimateStylePlugin from './plugins/LayerAnimateStylePlugin'; +import LayerModelPlugin from './plugins/LayerModelPlugin'; import LayerStylePlugin from './plugins/LayerStylePlugin'; import LightingPlugin from './plugins/LightingPlugin'; import MultiPassRendererPlugin from './plugins/MultiPassRendererPlugin'; @@ -119,6 +120,13 @@ container .bind(TYPES.ILayerPlugin) .to(PixelPickingPlugin) .inRequestScope(); +/** + * 初始化Model + */ +container + .bind(TYPES.ILayerPlugin) + .to(LayerModelPlugin) + .inRequestScope(); export { BaseLayer, diff --git a/packages/layers/src/line/index.ts b/packages/layers/src/line/index.ts index 2f1054c0ed..6280b78af3 100644 --- a/packages/layers/src/line/index.ts +++ b/packages/layers/src/line/index.ts @@ -5,6 +5,12 @@ import LineModels, { LineModelType } from './models'; export default class LineLayer extends BaseLayer { public type: string = 'LineLayer'; + public buildModels() { + const shape = this.getModelType(); + this.layerModel = new LineModels[shape](this); + this.models = this.layerModel.buildModels(); + } + protected getConfigSchema() { return { properties: { @@ -26,12 +32,6 @@ export default class LineLayer extends BaseLayer { }; return defaultConfig[type]; } - - protected buildModels() { - const shape = this.getModelType(); - this.layerModel = new LineModels[shape](this); - this.models = this.layerModel.buildModels(); - } protected getModelType(): LineModelType { const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute( 'shape', diff --git a/packages/layers/src/plugins/DataMappingPlugin.ts b/packages/layers/src/plugins/DataMappingPlugin.ts index 8123bb6604..25fa07b7c6 100644 --- a/packages/layers/src/plugins/DataMappingPlugin.ts +++ b/packages/layers/src/plugins/DataMappingPlugin.ts @@ -87,7 +87,7 @@ export default class DataMappingPlugin implements ILayerPlugin { coordinates: record.coordinates, }; attributes - // .filter((attribute) => attribute.name !== 'filter') + .filter((attribute) => attribute.scale !== undefined) .forEach((attribute: IStyleAttribute) => { let values = this.applyAttributeMapping(attribute, record); attribute.needRemapping = false; diff --git a/packages/layers/src/plugins/DataSourcePlugin.ts b/packages/layers/src/plugins/DataSourcePlugin.ts index b9683f93b5..2ca89a5efb 100644 --- a/packages/layers/src/plugins/DataSourcePlugin.ts +++ b/packages/layers/src/plugins/DataSourcePlugin.ts @@ -10,6 +10,9 @@ export default class DataSourcePlugin implements ILayerPlugin { layer.hooks.init.tap('DataSourcePlugin', () => { const { data, options } = layer.sourceOption; layer.setSource(new Source(data, options)); + // if (layer.getSource().data.dataArray.length === 0) { + // return true; + // } this.updateClusterData(layer); }); diff --git a/packages/layers/src/plugins/LayerModelPlugin.ts b/packages/layers/src/plugins/LayerModelPlugin.ts new file mode 100644 index 0000000000..4dccd8056c --- /dev/null +++ b/packages/layers/src/plugins/LayerModelPlugin.ts @@ -0,0 +1,26 @@ +import { ILayer, ILayerPlugin, IMapService, TYPES } from '@antv/l7-core'; +import { injectable } from 'inversify'; +/** + * Layer Model 初始化,更新,销毁 + */ +@injectable() +export default class LayerModelPlugin implements ILayerPlugin { + public apply(layer: ILayer) { + layer.hooks.init.tap('LayerModelPlugin', () => { + // 更新Model 配置项 + layer.prepareBuildModel(); + // 初始化 Model + layer.buildModels(); + }); + + layer.hooks.beforeRenderData.tap('DataSourcePlugin', (flag) => { + // 更新Model 配置项 + if (flag) { + layer.prepareBuildModel(); + // 初始化 Model + layer.buildModels(); + } + return false; + }); + } +} diff --git a/packages/layers/src/plugins/LayerStylePlugin.ts b/packages/layers/src/plugins/LayerStylePlugin.ts index 2df6c7a27f..45e38793aa 100644 --- a/packages/layers/src/plugins/LayerStylePlugin.ts +++ b/packages/layers/src/plugins/LayerStylePlugin.ts @@ -9,6 +9,7 @@ import { injectable } from 'inversify'; export default class LayerStylePlugin implements ILayerPlugin { public apply(layer: ILayer) { layer.hooks.afterInit.tap('LayerStylePlugin', () => { + // 更新图层默认状态 layer.updateLayerConfig({}); const { autoFit } = layer.getLayerConfig(); if (autoFit) { diff --git a/packages/layers/src/point/index.ts b/packages/layers/src/point/index.ts index fc5242dba6..e95b792e73 100644 --- a/packages/layers/src/point/index.ts +++ b/packages/layers/src/point/index.ts @@ -8,6 +8,11 @@ interface IPointLayerStyleOptions { } export default class PointLayer extends BaseLayer { public type: string = 'PointLayer'; + public buildModels() { + const modelType = this.getModelType(); + this.layerModel = new PointModels[modelType](this); + this.models = this.layerModel.buildModels(); + } protected getConfigSchema() { return { properties: { @@ -34,11 +39,6 @@ export default class PointLayer extends BaseLayer { }; return defaultConfig[type]; } - protected buildModels() { - const modelType = this.getModelType(); - this.layerModel = new PointModels[modelType](this); - this.models = this.layerModel.buildModels(); - } protected getModelType(): PointType { // pointlayer diff --git a/packages/layers/src/polygon/index.ts b/packages/layers/src/polygon/index.ts index a0d20033bb..f8e7d36cb7 100644 --- a/packages/layers/src/polygon/index.ts +++ b/packages/layers/src/polygon/index.ts @@ -9,6 +9,11 @@ interface IPolygonLayerStyleOptions { export default class PolygonLayer extends BaseLayer { public type: string = 'PolygonLayer'; + public buildModels() { + const shape = this.getModelType(); + this.layerModel = new PolygonModels[shape](this); + this.models = this.layerModel.buildModels(); + } protected getConfigSchema() { return { @@ -21,11 +26,6 @@ export default class PolygonLayer extends BaseLayer { }, }; } - protected buildModels() { - const shape = this.getModelType(); - this.layerModel = new PolygonModels[shape](this); - this.models = this.layerModel.buildModels(); - } protected getModelType(): PolygonModelType { const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute( diff --git a/packages/layers/src/raster/image.ts b/packages/layers/src/raster/image.ts index 164b9417bb..0722b79a59 100644 --- a/packages/layers/src/raster/image.ts +++ b/packages/layers/src/raster/image.ts @@ -45,7 +45,7 @@ // return this; // } -// protected buildModels() { +// public buildModels() { // this.registerBuiltinAttributes(); // const source = this.getSource(); // const { createTexture2D } = this.rendererService; diff --git a/packages/layers/src/raster/index.ts b/packages/layers/src/raster/index.ts index 24514ae65b..f6c0692877 100644 --- a/packages/layers/src/raster/index.ts +++ b/packages/layers/src/raster/index.ts @@ -11,6 +11,11 @@ interface IRasterLayerStyleOptions { } export default class RaterLayer extends BaseLayer { public type: string = 'RasterLayer'; + public buildModels() { + const modelType = this.getModelType(); + this.layerModel = new RasterModels[modelType](this); + this.models = this.layerModel.buildModels(); + } protected getConfigSchema() { return { properties: { @@ -30,11 +35,6 @@ export default class RaterLayer extends BaseLayer { }; return defaultConfig[type]; } - protected buildModels() { - const modelType = this.getModelType(); - this.layerModel = new RasterModels[modelType](this); - this.models = this.layerModel.buildModels(); - } protected getModelType(): RasterModelType { return 'raster'; diff --git a/packages/layers/src/raster/raster.ts b/packages/layers/src/raster/raster.ts index 45fb71957c..c91f142845 100644 --- a/packages/layers/src/raster/raster.ts +++ b/packages/layers/src/raster/raster.ts @@ -35,6 +35,28 @@ export default class RasterLayer extends BaseLayer { public getAnimateUniforms(): IModelUniform { return {}; } + + public buildModels() { + const parserDataItem = this.getSource().data.dataArray[0]; + const { createTexture2D } = this.rendererService; + this.texture = createTexture2D({ + data: parserDataItem.data, + width: parserDataItem.width, + height: parserDataItem.height, + format: gl.LUMINANCE, + type: gl.FLOAT, + aniso: 4, + }); + const { rampColors } = this.getLayerConfig(); + const imageData = generateColorRamp(rampColors as IColorRamp); + this.colorTexture = createTexture2D({ + data: imageData.data, + width: imageData.width, + height: imageData.height, + flipY: true, + }); + this.models = [this.buildRasterModel()]; + } protected getConfigSchema() { return { properties: { @@ -69,28 +91,6 @@ export default class RasterLayer extends BaseLayer { return this; } - - protected buildModels() { - const parserDataItem = this.getSource().data.dataArray[0]; - const { createTexture2D } = this.rendererService; - this.texture = createTexture2D({ - data: parserDataItem.data, - width: parserDataItem.width, - height: parserDataItem.height, - format: gl.LUMINANCE, - type: gl.FLOAT, - aniso: 4, - }); - const { rampColors } = this.getLayerConfig(); - const imageData = generateColorRamp(rampColors as IColorRamp); - this.colorTexture = createTexture2D({ - data: imageData.data, - width: imageData.width, - height: imageData.height, - flipY: true, - }); - this.models = [this.buildRasterModel()]; - } private buildRasterModel() { const source = this.getSource(); const sourceFeature = source.data.dataArray[0]; diff --git a/packages/layers/src/raster/raster2d.ts b/packages/layers/src/raster/raster2d.ts index 17ca71129b..e7f26d8093 100644 --- a/packages/layers/src/raster/raster2d.ts +++ b/packages/layers/src/raster/raster2d.ts @@ -16,40 +16,7 @@ export default class Raster2dLayer extends BaseLayer { protected texture: ITexture2D; protected colorTexture: ITexture2D; - protected getConfigSchema() { - return { - properties: { - opacity: { - type: 'number', - minimum: 0, - maximum: 1, - }, - }, - }; - } - - protected renderModels() { - const { opacity } = this.getLayerConfig(); - const parserDataItem = this.getSource().data.dataArray[0]; - const { min, max } = parserDataItem; - if (this.texture) { - this.models.forEach((model) => - model.draw({ - uniforms: { - u_opacity: opacity || 1, - u_texture: this.texture, - u_min: min, - u_max: max, - u_colorTexture: this.colorTexture, - }, - }), - ); - } - - return this; - } - - protected buildModels() { + public buildModels() { this.registerBuiltinAttributes(); const source = this.getSource(); const { createTexture2D } = this.rendererService; @@ -91,6 +58,39 @@ export default class Raster2dLayer extends BaseLayer { ]; } + protected getConfigSchema() { + return { + properties: { + opacity: { + type: 'number', + minimum: 0, + maximum: 1, + }, + }, + }; + } + + protected renderModels() { + const { opacity } = this.getLayerConfig(); + const parserDataItem = this.getSource().data.dataArray[0]; + const { min, max } = parserDataItem; + if (this.texture) { + this.models.forEach((model) => + model.draw({ + uniforms: { + u_opacity: opacity || 1, + u_texture: this.texture, + u_min: min, + u_max: max, + u_colorTexture: this.colorTexture, + }, + }), + ); + } + + return this; + } + private registerBuiltinAttributes() { // point layer size; this.styleAttributeService.registerStyleAttribute({ diff --git a/packages/maps/src/amap/index.ts b/packages/maps/src/amap/index.ts index 5ba8b609be..c3a7fbe467 100644 --- a/packages/maps/src/amap/index.ts +++ b/packages/maps/src/amap/index.ts @@ -209,8 +209,8 @@ export default class AMapService const ll = new AMap.Pixel(pixel[0], pixel[1]); const lngLat = this.map.containerToLngLat(ll); return { - lng: lngLat.getLng(), - lat: lngLat.getLat(), + lng: lngLat?.getLng(), + lat: lngLat?.getLat(), }; } public lngLatToContainer(lnglat: [number, number]): IPoint { diff --git a/packages/source/src/parser/geojson.ts b/packages/source/src/parser/geojson.ts index bf050352be..f02798c2b6 100644 --- a/packages/source/src/parser/geojson.ts +++ b/packages/source/src/parser/geojson.ts @@ -34,6 +34,12 @@ export default function geoJSON( geometry.coordinates.length > 0 ); }); + if (data.features.length === 0) { + return { + dataArray: [], + featureKeys, + }; + } // 数据为空时处理 const i = 0; // multi polygon 拆分 diff --git a/stories/Components/components/Zoom.tsx b/stories/Components/components/Zoom.tsx index 5b7407e0ac..9e11c6dd96 100644 --- a/stories/Components/components/Zoom.tsx +++ b/stories/Components/components/Zoom.tsx @@ -1,6 +1,6 @@ // @ts-ignore import { PolygonLayer, Scene, Zoom } from '@antv/l7'; -import { Mapbox } from '@antv/l7-maps'; +import { GaodeMap } from '@antv/l7-maps'; import * as React from 'react'; @@ -18,10 +18,12 @@ export default class ZoomComponent extends React.Component { const data = await response.json(); const scene = new Scene({ id: 'map', - map: new Mapbox({ + map: new GaodeMap({ style: 'dark', center: [110.19382669582967, 30.258134], pitch: 0, + minZoom: 2, + maxZoom: 6, zoom: 3, }), }); diff --git a/stories/Layers/components/Arcline.tsx b/stories/Layers/components/Arcline.tsx index 5a350fd5eb..7203d26b97 100644 --- a/stories/Layers/components/Arcline.tsx +++ b/stories/Layers/components/Arcline.tsx @@ -41,6 +41,9 @@ export default class ArcLineDemo extends React.Component { .select({ color: 'red', }) + .active({ + color: 'red', + }) .color('rgb(13,64,140)') .animate({ enable: true, diff --git a/stories/Layers/components/HeatMap.tsx b/stories/Layers/components/HeatMap.tsx index 0ca9fdf800..db5caea45a 100644 --- a/stories/Layers/components/HeatMap.tsx +++ b/stories/Layers/components/HeatMap.tsx @@ -20,40 +20,42 @@ export default class HeatMapLayerDemo extends React.Component { map: new Mapbox({ center: [121.268, 30.3628], pitch: 0, - style: 'mapbox://styles/mapbox/dark-v10', + style: 'dark', zoom: 2, }), }); - const layer = new HeatmapLayer({ - enableTAA: false, - }); + const data = await response.json(); + + const layer = new HeatmapLayer(); layer - .source(await response.json()) - .size('mag', [0, 1]) // weight映射通道 + .source({ + type: 'FeatureCollection', + features: [], + }) + .shape('heatmap') + .size('mag', [0, 1.0]) // weight映射通道 .style({ intensity: 2, radius: 20, - opacity: 0.6, + opacity: 1.0, rampColors: { colors: [ - '#2E8AE6', - '#69D1AB', - '#DAF291', - '#FFD591', - '#FF7A45', - '#CF1D49', - ], + '#FF4818', + '#F7B74A', + '#FFF598', + '#91EABC', + '#2EA9A1', + '#206C7C', + ].reverse(), positions: [0, 0.2, 0.4, 0.6, 0.8, 1.0], }, }); scene.addLayer(layer); - // requestAnimationFrame(run); - scene.render(); + layer.setData({ + type: 'FeatureCollection', + features: data.features.slice(0, 100), + }); this.scene = scene; - // function run() { - // scene.render(); - // requestAnimationFrame(run); - // } } public render() { diff --git a/yarn.lock b/yarn.lock index 5c4a08ca77..a318065296 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2750,7 +2750,7 @@ mkdirp "^0.5.1" rimraf "^2.5.2" -"@mikaelkristiansson/domready@^1.0.9": +"@mikaelkristiansson/domready@^1.0.10": version "1.0.10" resolved "https://registry.npmjs.org/@mikaelkristiansson/domready/-/domready-1.0.10.tgz#f6d69866c0857664e70690d7a0bfedb72143adb5" integrity sha512-6cDuZeKSCSJ1KvfEQ25Y8OXUjqDJZ+HgUs6dhASWbAX8fxVraTfPsSeRe2bN+4QJDsgUaXaMWBYfRomCr04GGg== @@ -2962,31 +2962,31 @@ resolved "https://registry.npmjs.org/@stackblitz/sdk/-/sdk-1.3.0.tgz#519ab810df811a5b9fe60c3e69112d6fa713ec1d" integrity sha512-dTqbGKHLowJokC+mbjHMH/9mEd0AJCxOXmsfuKGEWOjnVTnxHjJKXL+bL/vxBSjMwBaUFPUNGmHojPPd2OxADQ== -"@storybook/addons@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/addons/-/addons-5.3.3.tgz#d1383379c27c205bd36961a5a833f1eec3850dd4" - integrity sha512-B7X21g+mlH0SMmP9MEgLPJltRjr36n9OtUtXkMhPae/B4AwiAm+krXmE4OxC5IEyl6m9Tmp4DJDYyZ2afzLBDg== +"@storybook/addons@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/addons/-/addons-5.3.5.tgz#0ee41838d8fde8787ca7366bc42039adae55cab3" + integrity sha512-s7zWmnNxpwnEpb3kG1+dRudaK+RRezOH6WC3QlNqU8j1trlhFgbooqV2nIsC6yj57OZn4MLHtzuFelxs9jqTzg== dependencies: - "@storybook/api" "5.3.3" - "@storybook/channels" "5.3.3" - "@storybook/client-logger" "5.3.3" - "@storybook/core-events" "5.3.3" + "@storybook/api" "5.3.5" + "@storybook/channels" "5.3.5" + "@storybook/client-logger" "5.3.5" + "@storybook/core-events" "5.3.5" core-js "^3.0.1" global "^4.3.2" util-deprecate "^1.0.2" -"@storybook/api@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/api/-/api-5.3.3.tgz#a9d4f6a61167bfc2bf1197f361f4d3c5ae7d9143" - integrity sha512-ZxehdzUelOABCWvDT33PukMD1eJhum3K60NMb5Pf46zvMJYbLLgPPszf6hBPjv1FmeZlYzfReyLVOhhUixYUyQ== +"@storybook/api@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/api/-/api-5.3.5.tgz#0641daac9b734e5260397b8789b774026126636a" + integrity sha512-fDRxpD1fUD/16Z+OnG6rFD71o9A2TyCXGS0Ey1yaNiqnroPplD2kwjz2T4iLsJwvIu3pSnvDCjijbLqYsfeaPg== dependencies: "@reach/router" "^1.2.1" - "@storybook/channels" "5.3.3" - "@storybook/client-logger" "5.3.3" - "@storybook/core-events" "5.3.3" + "@storybook/channels" "5.3.5" + "@storybook/client-logger" "5.3.5" + "@storybook/core-events" "5.3.5" "@storybook/csf" "0.0.1" - "@storybook/router" "5.3.3" - "@storybook/theming" "5.3.3" + "@storybook/router" "5.3.5" + "@storybook/theming" "5.3.5" "@types/reach__router" "^1.2.3" core-js "^3.0.1" fast-deep-equal "^2.0.1" @@ -3001,34 +3001,34 @@ telejson "^3.2.0" util-deprecate "^1.0.2" -"@storybook/channel-postmessage@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/channel-postmessage/-/channel-postmessage-5.3.3.tgz#085e0af0ebe2b32d2ba0efced90a1036ac5614a3" - integrity sha512-2MxXF/7TI8QXi+ATr5kzU06SsOSFuzX5s244Lp016VFdBj5o93rEpOdpDjanh+2AWYTeJY1lvk6QLUzuMqydpA== +"@storybook/channel-postmessage@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/channel-postmessage/-/channel-postmessage-5.3.5.tgz#cdf6b41d5e07ba913443c37b1d0e5c978eebfbfb" + integrity sha512-wpKXbrh3lYgZc7RFHyyFvxyYaf1XLiIz1tN5ANpahjF1vp0rnZbNcUDqTHFAG1EDvIPMPcIdrUfdfu4RDXG44A== dependencies: - "@storybook/channels" "5.3.3" - "@storybook/client-logger" "5.3.3" + "@storybook/channels" "5.3.5" + "@storybook/client-logger" "5.3.5" core-js "^3.0.1" global "^4.3.2" telejson "^3.2.0" -"@storybook/channels@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/channels/-/channels-5.3.3.tgz#839b02ce5527326e73af2e9003b3ab5d4642e1d6" - integrity sha512-HmIviGw9yv3T19PNBizHW0H67exqQQcwk82AJ76upEJ6iE5CMRZd7WYU7UM6ul00yfy8F+afAVlYCg2p79bQ+g== +"@storybook/channels@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/channels/-/channels-5.3.5.tgz#8c9959aa8d8281d6416605f276f85082ceee8afb" + integrity sha512-er5H7xklnQEuY1E+Ai20ROgsIIu0vSVL3TgvHUGBn5x4gjJnZay86l5qYwknXHMDZdiZjLjIzTez1KRPT/vtnQ== dependencies: core-js "^3.0.1" -"@storybook/client-api@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/client-api/-/client-api-5.3.3.tgz#e9693c0c765d00e6dd1522350ff7ee03c1a815ee" - integrity sha512-CexHAvfdHvYVJbVvEwDA+2WGKeVr+QDIHgI/n16CPPSQ4LwWbe2DXD4Iy7lZj5+WiziZ7B6jAzpM+lTwhbSQHQ== +"@storybook/client-api@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/client-api/-/client-api-5.3.5.tgz#4388e85f99b63c128989b82dcb7be60fe515b14c" + integrity sha512-tRw2gPi8IVEhQw6G26ppyudd/ThDk2KJbzWHDru8Tbl8f75Ir2Z1PMmRe5XVhy689NYYT/fBfuhOlignjkrlWw== dependencies: - "@storybook/addons" "5.3.3" - "@storybook/channel-postmessage" "5.3.3" - "@storybook/channels" "5.3.3" - "@storybook/client-logger" "5.3.3" - "@storybook/core-events" "5.3.3" + "@storybook/addons" "5.3.5" + "@storybook/channel-postmessage" "5.3.5" + "@storybook/channels" "5.3.5" + "@storybook/client-logger" "5.3.5" + "@storybook/core-events" "5.3.5" "@storybook/csf" "0.0.1" core-js "^3.0.1" eventemitter3 "^4.0.0" @@ -3041,20 +3041,20 @@ ts-dedent "^1.1.0" util-deprecate "^1.0.2" -"@storybook/client-logger@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-5.3.3.tgz#c4cffb0523c2a5ca53c9ec2060e9433d135172e6" - integrity sha512-iyW8aZBNWm2xN4vfRsNC27/b6i7s8hg6aWvtJ+7y91MPn+NL6QgWi5YOaNc8hA3RY5fe+yEOM6H6fkLk0PsWEQ== +"@storybook/client-logger@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-5.3.5.tgz#6709098482b69d248df6908f6b25f172def62ca9" + integrity sha512-KBLSZCELjaktkDVuPw6qe+P1V4CPev/JyYsCkaGwkVUVudFJd0pZQ2tNHWLdEXpwn95k2OFoG3oLtzox5LptlA== dependencies: core-js "^3.0.1" -"@storybook/components@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/components/-/components-5.3.3.tgz#06e18f8b4872b17cd0a303cee7e989221ac7ba57" - integrity sha512-8S02WhMHBHD7CRpQTmWQXUWcbWiJ7kJ6fy0arTzM3MGe/TD9sR2691F0aXeZPljodkPBqj4JKUSTi+HujLAT5A== +"@storybook/components@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/components/-/components-5.3.5.tgz#3b2e93ed140c351775f43f4c8e4947144feb3a05" + integrity sha512-B8z5GwL5LL9lCwCTuJ1Amod6QJC1FfRfnTZYxUgRxG1EfiYsejoFeB2tOKlIy/EaX8Lmm3XE47A9I1FhBWvCHw== dependencies: - "@storybook/client-logger" "5.3.3" - "@storybook/theming" "5.3.3" + "@storybook/client-logger" "5.3.5" + "@storybook/theming" "5.3.5" "@types/react-syntax-highlighter" "11.0.2" "@types/react-textarea-autosize" "^4.3.3" core-js "^3.0.1" @@ -3075,33 +3075,33 @@ simplebar-react "^1.0.0-alpha.6" ts-dedent "^1.1.0" -"@storybook/core-events@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/core-events/-/core-events-5.3.3.tgz#ab09b2dc1219253888e11dd85fd58005121b8e9c" - integrity sha512-D1NpSMUCmd4N1n6iiIo3E2S5bGgZUao8EvQRgQUC15yX/cgvUwZ2bN5QLoekK0ybxTzLQMcicMxt+ti3tiTBSg== +"@storybook/core-events@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/core-events/-/core-events-5.3.5.tgz#ec09846ec21a130906014837bdd755cc1e4eb9e0" + integrity sha512-+nXv/yh6RiVQXO0OzkdclDmHrYUS42ora5xyeoEmWc6z6i46wi8KG4XQSrWQ+gHi+ORY6poGIFYMNlk78fmb9g== dependencies: core-js "^3.0.1" -"@storybook/core@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/core/-/core-5.3.3.tgz#4fae6ddce6a84fb181b98867c468329c54676958" - integrity sha512-JO9iTeRCYWeqF7Gtl00lru0Zx69dCGhFPAvP/deGI12ZQX3psdyS3Vq9IgLUpqXTs4uf/aGAzsbxq56vaAdrbg== +"@storybook/core@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/core/-/core-5.3.5.tgz#4e91e4eeac0edb69d0f5bbfff251ab7e0ed00ae7" + integrity sha512-3J//vbJkgqQ7xXBt78Hku+BN2xwNOalVw1RseBc9JQvNnFagYbl83REwldb24jkL+4lsGdxEY2ALEBSDdh8coQ== dependencies: "@babel/plugin-proposal-class-properties" "^7.7.0" "@babel/plugin-proposal-object-rest-spread" "^7.6.2" "@babel/plugin-syntax-dynamic-import" "^7.2.0" "@babel/plugin-transform-react-constant-elements" "^7.2.0" "@babel/preset-env" "^7.4.5" - "@storybook/addons" "5.3.3" - "@storybook/channel-postmessage" "5.3.3" - "@storybook/client-api" "5.3.3" - "@storybook/client-logger" "5.3.3" - "@storybook/core-events" "5.3.3" + "@storybook/addons" "5.3.5" + "@storybook/channel-postmessage" "5.3.5" + "@storybook/client-api" "5.3.5" + "@storybook/client-logger" "5.3.5" + "@storybook/core-events" "5.3.5" "@storybook/csf" "0.0.1" - "@storybook/node-logger" "5.3.3" - "@storybook/router" "5.3.3" - "@storybook/theming" "5.3.3" - "@storybook/ui" "5.3.3" + "@storybook/node-logger" "5.3.5" + "@storybook/router" "5.3.5" + "@storybook/theming" "5.3.5" + "@storybook/ui" "5.3.5" airbnb-js-shims "^2.2.1" ansi-to-html "^0.6.11" autoprefixer "^9.7.2" @@ -3168,10 +3168,10 @@ dependencies: lodash "^4.17.15" -"@storybook/node-logger@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-5.3.3.tgz#7a28519b485a89da668743e8ca974751bb3b7dd1" - integrity sha512-x2bvZQomd/XFp7TIdeLjaY0SEfNxEu3Z/PQwvwCV2RHaxc7teKuKRDMY6OzDrFEdxX3qzCO6Qe9lc/pL0Q0O9Q== +"@storybook/node-logger@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-5.3.5.tgz#412e6fc76c2e76e458121d76cd128e51b1a65ddc" + integrity sha512-kTXUTKNwLr+sofFJlM7iLc3C5b1JctL9T06fQZ7rMHKvDj5fQA4tQB2nLO1DcGm97k7PBo2khJwLouAW9Fvojg== dependencies: chalk "^3.0.0" core-js "^3.0.1" @@ -3180,16 +3180,16 @@ regenerator-runtime "^0.13.3" "@storybook/react@^5.1.9": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/react/-/react-5.3.3.tgz#0a0c1482ec55323e4aa6da000ec018355a0e1c2f" - integrity sha512-Oup5+NhP6R5Uo10U7oWKTZFVhrA8fSdxPjYu2lGPrhd5gJ4Pm3jwQXCpl+VrkJNBo/ZQehVqRc13hw87PIBBkw== + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/react/-/react-5.3.5.tgz#bd9096c60ade6cd3fe033b4cf2fd6647ce7b8d73" + integrity sha512-E2Ux1WqFELl+2THxBnGMT47mThSHHGB4qTij8mIUE2yXqBNGkz+RDO5TMaQjsbF1no8JvNKK+ePAMvUR1wPXIA== dependencies: "@babel/plugin-transform-react-constant-elements" "^7.6.3" "@babel/preset-flow" "^7.0.0" "@babel/preset-react" "^7.0.0" - "@storybook/addons" "5.3.3" - "@storybook/core" "5.3.3" - "@storybook/node-logger" "5.3.3" + "@storybook/addons" "5.3.5" + "@storybook/core" "5.3.5" + "@storybook/node-logger" "5.3.5" "@svgr/webpack" "^4.0.3" "@types/webpack-env" "^1.15.0" babel-plugin-add-react-displayname "^0.0.5" @@ -3206,10 +3206,10 @@ ts-dedent "^1.1.0" webpack "^4.33.0" -"@storybook/router@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/router/-/router-5.3.3.tgz#841c988620678366bcc483ccfc19324a2534cbf7" - integrity sha512-zmZ3TIU5wBsn3ez5f7n9XkUGpS0guszvFcFx5Q1vpSj6WJr0f6lyLG+Sj6hNPLoBXhUtXPRmIPHn5+vPQ7UDMg== +"@storybook/router@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/router/-/router-5.3.5.tgz#fd75cc3c3f5c9dd3cb815158d50934338389449f" + integrity sha512-XiLMybUhccm8mkO9KKec95wNNUgWnRpeO4f2q2RH8ii41HP2f3jd6SgDrBHdjEaNVeoeNvl1N3XbaBM9h/MYOA== dependencies: "@reach/router" "^1.2.1" "@storybook/csf" "0.0.1" @@ -3221,14 +3221,14 @@ qs "^6.6.0" util-deprecate "^1.0.2" -"@storybook/theming@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/theming/-/theming-5.3.3.tgz#3c58b696a608143cf436d6c511c3454c48c8087f" - integrity sha512-K5UK8xMlX2VQcSv4+5NM3MgUyHa5VGZ5lVTAFp8YYW30gdt3rskO1aih8TVx9HI4gpn+6OdMVp1I+IN+hvk5/Q== +"@storybook/theming@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/theming/-/theming-5.3.5.tgz#b53f87357c92aa85f149e33651fe85ad86b3fdf6" + integrity sha512-7L26KJn1tNIMrH+Lu6Y2Uiyk/q9QBQO+uFrOg6x8sNj0YY5ENU+pgA6EG8XF8itHZbw88iJvJ1da+mY406I4+g== dependencies: "@emotion/core" "^10.0.20" "@emotion/styled" "^10.0.17" - "@storybook/client-logger" "5.3.3" + "@storybook/client-logger" "5.3.5" core-js "^3.0.1" deep-object-diff "^1.1.0" emotion-theming "^10.0.19" @@ -3239,20 +3239,20 @@ resolve-from "^5.0.0" ts-dedent "^1.1.0" -"@storybook/ui@5.3.3": - version "5.3.3" - resolved "https://registry.npmjs.org/@storybook/ui/-/ui-5.3.3.tgz#a8e2d8ade181dfe09822176d7858f98a7f16ba90" - integrity sha512-p0qGYncwKLshzLZYq/6X8PntdUD1Sz73BI6XpLTwfV3jJYZMZD3v7QwXjucOyd/VfVF8gmJXZmhd/GCfVBdmMw== +"@storybook/ui@5.3.5": + version "5.3.5" + resolved "https://registry.npmjs.org/@storybook/ui/-/ui-5.3.5.tgz#3958d337da6314fa5e8683876eb5a9a75b34ed05" + integrity sha512-7oWXcWRAaKlf59YV24pJ8dMrkJpe0IeMBCS8kR3EsAdGVF6zSbNCFSKdzED6y2l14jIFyBo4eRCHCpZLKc9m4w== dependencies: "@emotion/core" "^10.0.20" - "@storybook/addons" "5.3.3" - "@storybook/api" "5.3.3" - "@storybook/channels" "5.3.3" - "@storybook/client-logger" "5.3.3" - "@storybook/components" "5.3.3" - "@storybook/core-events" "5.3.3" - "@storybook/router" "5.3.3" - "@storybook/theming" "5.3.3" + "@storybook/addons" "5.3.5" + "@storybook/api" "5.3.5" + "@storybook/channels" "5.3.5" + "@storybook/client-logger" "5.3.5" + "@storybook/components" "5.3.5" + "@storybook/core-events" "5.3.5" + "@storybook/router" "5.3.5" + "@storybook/theming" "5.3.5" copy-to-clipboard "^3.0.8" core-js "^3.0.1" core-js-pure "^3.0.1" @@ -4615,7 +4615,7 @@ array-ify@^1.0.0: resolved "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4= -array-includes@^3.0.3: +array-includes@^3.0.3, array-includes@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz#cdd67e6852bdf9c1215460786732255ed2459348" integrity sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ== @@ -8780,9 +8780,9 @@ electron-download@^4.1.0: sumchecker "^2.0.2" electron-to-chromium@^1.3.247, electron-to-chromium@^1.3.322, electron-to-chromium@^1.3.47: - version "1.3.335" - resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.335.tgz#5fb6084a25cb1e2542df91e62b62e1931a602303" - integrity sha512-ngKsDGd/xr2lAZvilxTfdvfEiQKmavyXd6irlswaHnewmXoz6JgbM9FUNwgp3NFIUHHegh1F87H8f5BJ8zABxw== + version "1.3.336" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.336.tgz#f0e7a3e78f1c9a0385b6693a4a4b7453f0ae6aaf" + integrity sha512-FtazvnXAizSVMxQNPqUcTv2UElY5r3uRPQwiU1Tyg/Yc2UFr+/3wqDoLIV9ES6ablW3IrCcR8uEK2ppxaNPWhw== electron@^6.0.7: version "6.1.7" @@ -9078,7 +9078,7 @@ error-stack-parser@^2.0.0, error-stack-parser@^2.0.6: dependencies: stackframe "^1.1.1" -es-abstract@^1.13.0, es-abstract@^1.17.0, es-abstract@^1.17.0-next.0, es-abstract@^1.17.0-next.1: +es-abstract@^1.13.0, es-abstract@^1.17.0, es-abstract@^1.17.0-next.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2: version "1.17.2" resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.2.tgz#965b10af56597b631da15872c17a405e86c1fd46" integrity sha512-YoKuru3Lyoy7yVTBSH2j7UxTqe/je3dWAruC0sHvZX1GNd5zX8SSLvQqEgO9b3Ex8IW+goFI9arEEsFIbulhOw== @@ -9250,11 +9250,6 @@ eslint-plugin-eggache@^1.0.0: resolved "https://registry.npmjs.org/eslint-plugin-eggache/-/eslint-plugin-eggache-1.0.0.tgz#1f8f98c698d2b511519fbdefbae78fe230487aa4" integrity sha512-LPTrTvITFDZggiXAIdMPL4bJo0wvXUgJqC3f6UIskJxzHZze2aBTvjWQJ7TgEbkfpk++KWhcOl+lels+qAPKDg== -eslint-plugin-eslint-plugin@^2.1.0: - version "2.2.0" - resolved "https://registry.npmjs.org/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.2.0.tgz#6cac90a8085f658e892b155dda130deac54cfa51" - integrity sha512-X5+NT9a2GuwWyb3sHJdEEe6aD/30Fhi3/9XCmYHe/OSnWKUhmKOxFTfFM1AXZfJXjAoX7811bnoLI3fZr5AX5Q== - eslint-plugin-flowtype@^3.13.0: version "3.13.0" resolved "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.13.0.tgz#e241ebd39c0ce519345a3f074ec1ebde4cf80f2c" @@ -9333,20 +9328,19 @@ eslint-plugin-react-hooks@^1.7.0: integrity sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA== eslint-plugin-react@^7.11.1, eslint-plugin-react@^7.17.0: - version "7.17.0" - resolved "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.17.0.tgz#a31b3e134b76046abe3cd278e7482bd35a1d12d7" - integrity sha512-ODB7yg6lxhBVMeiH1c7E95FLD4E/TwmFjltiU+ethv7KPdCwgiFuOZg9zNRHyufStTDLl/dEFqI2Q1VPmCd78A== + version "7.18.0" + resolved "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.18.0.tgz#2317831284d005b30aff8afb7c4e906f13fa8e7e" + integrity sha512-p+PGoGeV4SaZRDsXqdj9OWcOrOpZn8gXoGPcIQTzo2IDMbAKhNDnME9myZWqO3Ic4R3YmwAZ1lDjWl2R2hMUVQ== dependencies: - array-includes "^3.0.3" + array-includes "^3.1.1" doctrine "^2.1.0" - eslint-plugin-eslint-plugin "^2.1.0" has "^1.0.3" jsx-ast-utils "^2.2.3" - object.entries "^1.1.0" - object.fromentries "^2.0.1" - object.values "^1.1.0" + object.entries "^1.1.1" + object.fromentries "^2.0.2" + object.values "^1.1.1" prop-types "^15.7.2" - resolve "^1.13.1" + resolve "^1.14.2" eslint-scope@3.7.1: version "3.7.1" @@ -10830,9 +10824,9 @@ gatsby-plugin-sharp@^2.2.22: uuid "^3.3.3" gatsby-plugin-sitemap@^2.2.21: - version "2.2.25" - resolved "https://registry.npmjs.org/gatsby-plugin-sitemap/-/gatsby-plugin-sitemap-2.2.25.tgz#c3960fbd5eb42501dcad848c50afbfb4e8788cea" - integrity sha512-W1yz5EhEBT1je0a7+fr5T8/SxSfg9xGkVV6VV4Jt7RFBE8j2fNMcpfHpxcp1iiYM19y1fTJmM3OUNjBXANMCdQ== + version "2.2.26" + resolved "https://registry.npmjs.org/gatsby-plugin-sitemap/-/gatsby-plugin-sitemap-2.2.26.tgz#d0b9a9064966fd31b9ae46e769b05c904c20fd2f" + integrity sha512-0kqMM6zD4IWha7Af6kfzwk78870S8XGpOVNJojgtQ83eUu6mKQXdRuae/i52hjclSDsEprbvUfQT0yMxgOotGw== dependencies: "@babel/runtime" "^7.7.6" minimatch "^3.0.4" @@ -11004,9 +10998,9 @@ gatsby-transformer-sharp@^2.2.14: sharp "^0.23.4" gatsby@^2.15.16, gatsby@^2.17.7: - version "2.18.22" - resolved "https://registry.npmjs.org/gatsby/-/gatsby-2.18.22.tgz#1cbe78e58cdf1bf49ebbde778f22867176b962b1" - integrity sha512-eKhU3u/4qGbZrB57tNxHkmLROE+RK6PKaOYzj+hlDn2bDoo/Tbub3VUUeIuKX5wRGzNNDKOH49PHSKd0Ldrv5Q== + version "2.18.23" + resolved "https://registry.npmjs.org/gatsby/-/gatsby-2.18.23.tgz#1e590cba0fd405f0bb0d1417503556c30ed60904" + integrity sha512-BSM6hv9Qp8HKyAUPg6ow2vWIMHgaoRLCbwYdQzIhgqCapEUyH73gM9E/3saSOYgoYuiRCzKMJr/2MOAapjWxVQ== dependencies: "@babel/code-frame" "^7.5.5" "@babel/core" "^7.7.5" @@ -11015,7 +11009,7 @@ gatsby@^2.15.16, gatsby@^2.17.7: "@babel/runtime" "^7.7.6" "@babel/traverse" "^7.7.4" "@hapi/joi" "^15.1.1" - "@mikaelkristiansson/domready" "^1.0.9" + "@mikaelkristiansson/domready" "^1.0.10" "@pieh/friendly-errors-webpack-plugin" "1.7.0-chalk-2" "@reach/router" "^1.2.1" "@typescript-eslint/eslint-plugin" "^2.11.0" @@ -14446,9 +14440,9 @@ kind-of@^5.0.0: integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.2" - resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" - integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + version "6.0.3" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== klaw@^1.0.0: version "1.3.1" @@ -16333,9 +16327,9 @@ node-releases@^1.1.29, node-releases@^1.1.44: semver "^6.3.0" node-sass@^4.12.0: - version "4.13.0" - resolved "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz#b647288babdd6a1cb726de4545516b31f90da066" - integrity sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA== + version "4.13.1" + resolved "https://registry.npmjs.org/node-sass/-/node-sass-4.13.1.tgz#9db5689696bb2eec2c32b98bfea4c7a2e992d0a3" + integrity sha512-TTWFx+ZhyDx1Biiez2nB0L3YrCZ/8oHagaDalbuBSlqXgUPsdkUSzJsVxeDO9LtPB49+Fh3WQl3slABo6AotNw== dependencies: async-foreach "^0.1.3" chalk "^1.1.1" @@ -16712,7 +16706,7 @@ object.entries@^1.1.0, object.entries@^1.1.1: function-bind "^1.1.1" has "^1.0.3" -"object.fromentries@^2.0.0 || ^1.0.0", object.fromentries@^2.0.1, object.fromentries@^2.0.2: +"object.fromentries@^2.0.0 || ^1.0.0", object.fromentries@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.2.tgz#4a09c9b9bb3843dd0f89acdb517a794d4f355ac9" integrity sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ== @@ -16722,7 +16716,7 @@ object.entries@^1.1.0, object.entries@^1.1.1: function-bind "^1.1.1" has "^1.0.3" -object.getownpropertydescriptors@^2.0.3: +object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz#369bf1f9592d8ab89d712dced5cb81c7c5352649" integrity sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg== @@ -17748,9 +17742,9 @@ postcss-html@^0.36.0: htmlparser2 "^3.10.0" postcss-jsx@^0.36.0: - version "0.36.3" - resolved "https://registry.npmjs.org/postcss-jsx/-/postcss-jsx-0.36.3.tgz#c91113eae2935a1c94f00353b788ece9acae3f46" - integrity sha512-yV8Ndo6KzU8eho5mCn7LoLUGPkXrRXRjhMpX4AaYJ9wLJPv099xbtpbRQ8FrPnzVxb/cuMebbPR7LweSt+hTfA== + version "0.36.4" + resolved "https://registry.npmjs.org/postcss-jsx/-/postcss-jsx-0.36.4.tgz#37a68f300a39e5748d547f19a747b3257240bd50" + integrity sha512-jwO/7qWUvYuWYnpOb0+4bIIgJt7003pgU3P6nETBLaOyBXuTD55ho21xnals5nBrlpTIFodyd3/jBi6UO3dHvA== dependencies: "@babel/core" ">=7.2.2" @@ -19425,9 +19419,9 @@ react-hotkeys@2.0.0: prop-types "^15.6.1" react-i18next@^11.0.0, react-i18next@^11.0.1: - version "11.3.0" - resolved "https://registry.npmjs.org/react-i18next/-/react-i18next-11.3.0.tgz#8c827b084708924fd2e8c787aca78e0f7966fa44" - integrity sha512-ahpEF2wYmTHkrZiz/Kgh6qW7KT0ZV2Kd0PEr7277V9+qBmBQIYXwsCWjKEDNY/nTxFpfz4DlLPdVvjerWt7uqQ== + version "11.3.1" + resolved "https://registry.npmjs.org/react-i18next/-/react-i18next-11.3.1.tgz#9269282c3f566015f0bdf8fdbf46782bbe50f5a7" + integrity sha512-S/CWHcnew1lXo8HeniGhBU5kTmPhZ4w4rtA4m/gDN07soCtKKYSAcLNm7zhwjI2OSR4Skd0vOtzNp/FzEEjxIw== dependencies: "@babel/runtime" "^7.3.1" html-parse-stringify2 "2.0.1" @@ -19557,9 +19551,9 @@ react-textarea-autosize@^7.1.0: prop-types "^15.6.0" react-use@^13.8.0: - version "13.17.0" - resolved "https://registry.npmjs.org/react-use/-/react-use-13.17.0.tgz#5c4c2e3c85d586833dc6c10a5cadddb8b40a5d6d" - integrity sha512-0VY4H9RFavqMc5edYliSNUauXesM9K7wcnjqG0VfY+bPO/uOAqJRAdOUSg2tvdyLVR6IuKjk2F4dyOlHQ40y+w== + version "13.19.0" + resolved "https://registry.npmjs.org/react-use/-/react-use-13.19.0.tgz#00c7650012021e75b5cf9ea8c1b1b4e1c22eb076" + integrity sha512-By7d8ZhdWo0Ns2BW/Gla5EDrj9rTJ8p/ueJKv7SbqlDQvu9lpwovWGWKjY5Vjz5gAG3tZrSSxd1gK+gw7gZniQ== dependencies: "@types/js-cookie" "2.2.4" "@xobotyi/scrollbar-width" "1.5.0" @@ -20346,7 +20340,7 @@ resolve@1.1.7: resolved "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@1.x, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1, resolve@~1.14.2: +resolve@1.x, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1, resolve@~1.14.2: version "1.14.2" resolved "https://registry.npmjs.org/resolve/-/resolve-1.14.2.tgz#dbf31d0fa98b1f29aa5169783b9c290cb865fea2" integrity sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ== @@ -21458,9 +21452,9 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== sourcemap-codec@^1.4.1, sourcemap-codec@^1.4.4: - version "1.4.7" - resolved "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.7.tgz#5b2cd184e3fe51fd30ba049f7f62bf499b4f73ae" - integrity sha512-RuN23NzhAOuUtaivhcrjXx1OPXsFeH9m5sI373/U7+tGLKihjUyboZAzOadytMjnqHp1f45RGk1IzDKCpDpSYA== + version "1.4.8" + resolved "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== space-separated-tokens@^1.0.0: version "1.1.4" @@ -22263,9 +22257,9 @@ supports-color@^5.3.0, supports-color@^5.4.0: has-flag "^3.0.0" svg-parser@^2.0.0: - version "2.0.2" - resolved "https://registry.npmjs.org/svg-parser/-/svg-parser-2.0.2.tgz#d134cc396fa2681dc64f518330784e98bd801ec8" - integrity sha512-1gtApepKFweigFZj3sGO8KT8LvVZK8io146EzXrpVuWCDAbISz/yMucco3hWTkpZNoPabM+dnMOpy6Swue68Zg== + version "2.0.3" + resolved "https://registry.npmjs.org/svg-parser/-/svg-parser-2.0.3.tgz#a38f2e4e5442986f7ecb554c11f1411cfcf8c2b9" + integrity sha512-fnCWiifNhK8i2Z7b9R5tbNahpxrRdAaQbnoxKlT2KrSCj9Kq/yBSgulCRgBJRhy1dPnSY5slg5ehPUnzpEcHlg== svg-react-loader@^0.4.4: version "0.4.6" @@ -23048,9 +23042,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^3.7.0-beta, typescript@^3.7.4: - version "3.7.4" - resolved "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19" - integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw== + version "3.7.5" + resolved "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" + integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== ua-parser-js@^0.7.18: version "0.7.21" @@ -23556,7 +23550,7 @@ util-promisify@^2.1.0: dependencies: object.getownpropertydescriptors "^2.0.3" -util.promisify@1.0.0, util.promisify@^1.0.0, util.promisify@~1.0.0: +util.promisify@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== @@ -23564,6 +23558,16 @@ util.promisify@1.0.0, util.promisify@^1.0.0, util.promisify@~1.0.0: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" +util.promisify@^1.0.0, util.promisify@~1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz#6baf7774b80eeb0f7520d8b81d07982a59abbaee" + integrity sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.2" + has-symbols "^1.0.1" + object.getownpropertydescriptors "^2.1.0" + util@0.10.3: version "0.10.3" resolved "https://registry.npmjs.org/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" @@ -23588,11 +23592,16 @@ utils-merge@1.0.1: resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= -uuid@3.3.3, uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0, uuid@^3.3.2, uuid@^3.3.3: +uuid@3.3.3: version "3.3.3" resolved "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== +uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0, uuid@^3.3.2, uuid@^3.3.3: + version "3.4.0" + resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + v8-compile-cache@2.0.3: version "2.0.3" resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz#00f7494d2ae2b688cfe2899df6ed2c54bef91dbe" From 25d74cbc5a42b8ca4edd84dee70f794eb9bda351 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Sun, 19 Jan 2020 00:10:16 +0800 Subject: [PATCH 2/4] fix: gaodeMap Zoom in & Zoom out --- packages/maps/src/amap/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/maps/src/amap/index.ts b/packages/maps/src/amap/index.ts index c3a7fbe467..be812bff53 100644 --- a/packages/maps/src/amap/index.ts +++ b/packages/maps/src/amap/index.ts @@ -159,11 +159,11 @@ export default class AMapService public getMinZoom(): number { const zooms = this.map.get('zooms') as [number, number]; - return zooms[0]; + return zooms[0] - 1; } public getMaxZoom(): number { const zooms = this.map.get('zooms') as [number, number]; - return zooms[1]; + return zooms[1] - 1; } public setRotation(rotation: number): void { return this.map.setRotation(rotation); From 178fb36c9ee357bc8f382d0775d14bbd1e8cd56d Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Sun, 19 Jan 2020 19:40:25 +0800 Subject: [PATCH 3/4] fix: amap repeat js load --- docs/tutorial/data.en.md | 2 +- docs/tutorial/data.zh.md | 4 +- package.json | 2 +- packages/core/src/services/log/LogService.ts | 4 +- .../core/src/services/scene/SceneService.ts | 2 +- packages/maps/src/amap/index.ts | 54 +++++++------ stories/Layers/components/data_update.tsx | 12 +-- stories/MapAdaptor/components/MultiAMap.tsx | 76 +++++++++++++++++-- 8 files changed, 112 insertions(+), 44 deletions(-) diff --git a/docs/tutorial/data.en.md b/docs/tutorial/data.en.md index 483c3af048..45470c92aa 100644 --- a/docs/tutorial/data.en.md +++ b/docs/tutorial/data.en.md @@ -55,7 +55,7 @@ GeoJSON 支持点、线、面,等所有的空间数据格式。
CSV 支 } ``` -## 地理统计分析工具 +#### 全国行政区划GeoJON 支持省市县维度  [turfjs](http://turfjs.org/):  地理数据计算,处理,统计,分析的Javascript 库 ## 在线工具 diff --git a/docs/tutorial/data.zh.md b/docs/tutorial/data.zh.md index ac63abf260..7860943c6e 100644 --- a/docs/tutorial/data.zh.md +++ b/docs/tutorial/data.zh.md @@ -66,8 +66,8 @@ GeoJSON 支持点、线、面,等所有的空间数据格式。
CSV 支 ## 数据资源 -#### 全国行政区划边界  -[支持 geojson, svg下载](http://datav.aliyun.com/tools/atlas/#&lat=33.50475906922609&lng=104.32617187499999&zoom=4) +#### 全国行政区划GeoJON 支持省市县维度  +[geojson, svg下载](http://datav.aliyun.com/tools/atlas/#&lat=33.50475906922609&lng=104.32617187499999&zoom=4) #### HighCharts 全球行政区划数据集 diff --git a/package.json b/package.json index 7f39d1369f..7cd3690df6 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "test-live": "cross-env BABEL_ENV=test DEBUG_MODE=1 jest --watch packages/scene/__tests__/index.spec.ts ", "coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls", "tsc": "tsc", - "watch": "yarn clean && lerna exec --parallel -- cross-env BABEL_ENV=cjs NODE_ENV=production babel --watch src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", + "watch": "yarn clean && lerna exec --parallel -- cross-env BABEL_ENV=cjs babel --watch src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", "bundle": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js", "bundle:watch": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --watch", "glsl-minify": "node_modules/.bin/glsl-minifier -i ./build/example.frag -o ./build/example.min.frag", diff --git a/packages/core/src/services/log/LogService.ts b/packages/core/src/services/log/LogService.ts index fd419c2200..533e2d2145 100644 --- a/packages/core/src/services/log/LogService.ts +++ b/packages/core/src/services/log/LogService.ts @@ -1,8 +1,8 @@ import { injectable } from 'inversify'; import Probe, { Log } from 'probe.gl'; import { ILogService } from './ILogService'; - -const Logger = new Log({ id: 'L7' }).enable(false); +console.log(process.env.NODE_ENV) +const Logger = new Log({ id: 'L7' }).enable(true); // // 只输出 debug 级别以上的日志信息 Logger.priority = 5; diff --git a/packages/core/src/services/scene/SceneService.ts b/packages/core/src/services/scene/SceneService.ts index 52ef208091..006f46230e 100644 --- a/packages/core/src/services/scene/SceneService.ts +++ b/packages/core/src/services/scene/SceneService.ts @@ -144,7 +144,7 @@ export default class Scene extends EventEmitter implements ISceneService { this.markerService.addMarkerLayers(); // 地图初始化之后 才能初始化 container 上的交互 this.interactionService.init(); - this.logger.debug('map loaded'); + this.logger.debug(`map ${this.id} loaded`); }); /** diff --git a/packages/maps/src/amap/index.ts b/packages/maps/src/amap/index.ts index be812bff53..ef143e776d 100644 --- a/packages/maps/src/amap/index.ts +++ b/packages/maps/src/amap/index.ts @@ -248,43 +248,40 @@ export default class AMapService this.$mapContainer = this.creatAmapContainer( id as string | HTMLDivElement, ); - // @ts-ignore - this.map = new AMap.Map(this.$mapContainer, { + + const map = new AMap.Map(this.$mapContainer, { mapStyle: this.getMapStyle(style as string), zooms: [minZoom, maxZoom], viewMode: '3D', ...rest, }); // 监听地图相机事件 - this.map.on('camerachange', this.handleCameraChanged); - resolve(); + map.on('camerachange', this.handleCameraChanged); + // @ts-ignore + this.map = map; + setTimeout(() => { + resolve(); + }, 10); } }; - if (!document.getElementById(AMAP_SCRIPT_ID) || !mapInstance) { - // 异步加载高德地图 - // @see https://lbs.amap.com/api/javascript-api/guide/abc/load - // @ts-ignore - window.initAMap = (): void => { - amapLoaded = true; + if (!amapLoaded && !mapInstance) { + if (token === AMAP_API_KEY) { + this.logger.warn(this.configService.getSceneWarninfo('MapToken')); + } + amapLoaded = true; + this.loadAMapScript( + `https://webapi.amap.com/maps?v=${AMAP_VERSION}&key=${token}&plugin=Map3D${plugin.join( + ',', + )}`, + ).then(() => { resolveMap(); if (pendingResolveQueue.length) { pendingResolveQueue.forEach((r) => r()); pendingResolveQueue = []; } - }; - if (token === AMAP_API_KEY) { - this.logger.warn(this.configService.getSceneWarninfo('MapToken')); - } - const url: string = `https://webapi.amap.com/maps?v=${AMAP_VERSION}&key=${token}&plugin=Map3D${plugin.join( - ',', - )}&callback=initAMap`; - const $jsapi = document.createElement('script'); - $jsapi.id = AMAP_SCRIPT_ID; - $jsapi.charset = 'utf-8'; - $jsapi.src = url; - document.head.appendChild($jsapi); + }); } else { - if (amapLoaded || mapInstance) { + if ((amapLoaded && window.AMap) || mapInstance) { resolveMap(); } else { pendingResolveQueue.push(resolveMap); @@ -381,4 +378,15 @@ export default class AMapService $wrapper.appendChild($amapdiv); return $amapdiv; } + private loadAMapScript(src: string) { + return new Promise((resolve, reject) => { + const script = document.createElement('script'); + script.src = src; + script.onload = () => { + resolve(); + }; + script.onerror = reject; + document.head.appendChild(script); + }); + } } diff --git a/stories/Layers/components/data_update.tsx b/stories/Layers/components/data_update.tsx index 4325d7a105..1610e537b8 100644 --- a/stories/Layers/components/data_update.tsx +++ b/stories/Layers/components/data_update.tsx @@ -55,13 +55,13 @@ export default class DataUpdate extends React.Component { scene.addLayer(layer); layer.setData(pointOnCircle(1000)); scene.render(); - // function animateMarker(timestamp: number) { - // layer.setData(pointOnCircle(timestamp / 1000)); - // scene.render(); - // requestAnimationFrame(animateMarker); - // } + function animateMarker(timestamp: number) { + layer.setData(pointOnCircle(timestamp / 1000)); + scene.render(); + requestAnimationFrame(animateMarker); + } // layer.on('inited', () => { - // animateMarker(0); + animateMarker(0); // }); } diff --git a/stories/MapAdaptor/components/MultiAMap.tsx b/stories/MapAdaptor/components/MultiAMap.tsx index 45cbe6cdc8..73837a61af 100644 --- a/stories/MapAdaptor/components/MultiAMap.tsx +++ b/stories/MapAdaptor/components/MultiAMap.tsx @@ -1,5 +1,5 @@ // @ts-ignore -import { Scene } from '@antv/l7'; +import { PointLayer, Scene } from '@antv/l7'; import { GaodeMap } from '@antv/l7-maps'; import * as React from 'react'; @@ -14,26 +14,86 @@ export default class MultiGaodeMap extends React.Component { public async componentDidMount() { const response = await fetch( - 'https://gw.alipayobjects.com/os/basement_prod/d2e0e930-fd44-4fca-8872-c1037b0fee7b.json', + 'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json', ); + const data = await response.json(); const scene1 = new Scene({ id: 'map1', map: new GaodeMap({ - center: [110.19382669582967, 50.258134], - pitch: 0, + center: [121.435159, 31.256971], + zoom: 14.89, style: 'light', - zoom: 3, }), }); const scene2 = new Scene({ id: 'map2', map: new GaodeMap({ - center: [110.19382669582967, 50.258134], - pitch: 0, + center: [121.435159, 31.256971], + zoom: 14.89, style: 'dark', - zoom: 3, }), }); + + const pointLayer = new PointLayer({}) + .source(data, { + parser: { + type: 'json', + x: 'longitude', + y: 'latitude', + }, + }) + .shape('name', [ + 'circle', + 'triangle', + 'square', + 'pentagon', + 'hexagon', + 'octogon', + 'hexagram', + 'rhombus', + 'vesica', + ]) + .size('unit_price', [10, 25]) + .active(true) + .color('name', ['#5B8FF9', '#5CCEA1', '#5D7092', '#F6BD16', '#E86452']) + .style({ + opacity: 0.3, + strokeWidth: 2, + }); + + const pointLayer2 = new PointLayer({}) + .source(data, { + parser: { + type: 'json', + x: 'longitude', + y: 'latitude', + }, + }) + .shape('name', [ + 'circle', + 'triangle', + 'square', + 'pentagon', + 'hexagon', + 'octogon', + 'hexagram', + 'rhombus', + 'vesica', + ]) + .size('unit_price', [10, 25]) + .active(true) + .color('#5B8FF9') + .style({ + opacity: 0.3, + strokeWidth: 2, + }); + scene1.on('loaded', () => { + scene1.addLayer(pointLayer); + }); + scene2.on('loaded', () => { + scene2.addLayer(pointLayer2); + }); + this.scene1 = scene1; this.scene2 = scene2; } From b56c16ff159f50af52a71a354a735b969a4848f9 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Sun, 19 Jan 2020 20:22:30 +0800 Subject: [PATCH 4/4] fix: layer add,remove enent --- docs/api/component/marker.zh.md | 2 + docs/api/component/popup.en.md | 4 +- docs/api/component/popup.zh.md | 5 +- docs/api/layer/layer.en.md | 278 ++++++++++++++++--- docs/api/layer/layer.zh.md | 16 ++ gatsby-config.js | 2 +- packages/core/src/services/log/LogService.ts | 3 +- packages/layers/src/core/BaseLayer.ts | 15 +- 8 files changed, 283 insertions(+), 42 deletions(-) diff --git a/docs/api/component/marker.zh.md b/docs/api/component/marker.zh.md index dcba499aa9..201ff3885f 100644 --- a/docs/api/component/marker.zh.md +++ b/docs/api/component/marker.zh.md @@ -118,3 +118,5 @@ new L7.Marker({ ```javascript marker.on('click', (e) => {}); ``` +## demo 地址 +[demo1](../../../examples/tutorial/marker) diff --git a/docs/api/component/popup.en.md b/docs/api/component/popup.en.md index ae3e7e9888..6042017242 100644 --- a/docs/api/component/popup.en.md +++ b/docs/api/component/popup.en.md @@ -93,4 +93,6 @@ popup.on('close', () => {}); const new L7.Popup().setLnglat([112, 32]).setHTML(html).addTo(scene); ``` -### FAQ +## demo 地址 +[demo1](../../../examples/point/column) +[demo2](../../../examples/line/path) diff --git a/docs/api/component/popup.zh.md b/docs/api/component/popup.zh.md index 81e1ad08b4..b8c2fc54a2 100644 --- a/docs/api/component/popup.zh.md +++ b/docs/api/component/popup.zh.md @@ -93,4 +93,7 @@ popup.on('close', () => {}); const new L7.Popup().setLnglat([112, 32]).setHTML(html).addTo(scene); ``` -### FAQ +## demo 地址 +[demo1](../../../examples/point/column) +[demo2](../../../examples/line/path) + diff --git a/docs/api/layer/layer.en.md b/docs/api/layer/layer.en.md index d274a4f841..908a7389cb 100644 --- a/docs/api/layer/layer.en.md +++ b/docs/api/layer/layer.en.md @@ -1,5 +1,5 @@ --- -title: Map Layer +title: Layer order: 0 --- @@ -26,6 +26,10 @@ scene.addLayer(layer); ## 配置项 +### name + +设置图层名称,可根据 name 获取 layer; + ### visable 图层是否可见   {bool } default true @@ -42,23 +46,16 @@ scene.addLayer(layer); 图层显示最大缩放等级 (0-18)   {number}  default 18 -## 鼠标事件 +### blend -⚠️ beta 版当前不支持,正式版会支持 +图层元素混合效果 -```javascript -layer.on('click', (ev) => {}); // 鼠标左键点击图层事件 -layer.on('dblclick', (ev) => {}); // 鼠标左键双击图层事件 -layer.on('mousemove', (ev) => {}); // 鼠标在图层上移动时触发 -layer.on('mouseover', (ev) => {}); // 鼠标移入图层要素内时触发 -layer.on('mouseout', (ev) => {}); // 鼠标移出图层要素时触发 -layer.on('mouseup', (ev) => {}); // 鼠标在图层上单击抬起时触发 -layer.on('mousedown', (ev) => {}); // 鼠标在图层上单击按下时触发 -layer.on('mouseleave', (ev) => {}); // 鼠标离开图层要素 -layer.on('rightclick', (ev) => {}); // 鼠标右键图层要素 -``` +- normal 正常效果 默认 +- additive 叠加模式 +- subtractive 相减模式 +- max 最大值 -## 方法 +# 方法 ### source @@ -103,8 +100,6 @@ layer.source(data, { }); ``` -### - ### scale cscle('field', scaleConfig) @@ -123,21 +118,15 @@ cscle('field', scaleConfig) } ``` +## 视觉编码方法 + +可视化编码是将数据转换为可视形式的过程,L7 目前支持形状,大小,颜色 3 种视觉通过,你可以指定数据字段,为不同要素设置不同的图形属性。 + ### size -将数据值映射到图形的大小上的方法。 +将数据值映射到图形的大小上的方法,具体 size 的表示具体意义可以查看对应图层的文档 -**注意:** - -不同图层的 size 的含义有所差别: - -- point 图形的 size 影响点的半径大小和高度; - -- line, arc, path 中的 size 影响线的粗细,和高度; - -- polygon size 影响的是高度 - -```javascript +``` pointLayer.size(10); // 常量 pointLayer.size('type'); // 使用字段映射到大小 pointLayer.size('type', [0, 10]); // 使用字段映射到大小,并指定最大值和最小值 @@ -267,24 +256,58 @@ layer.color('gender*age', (gender, age) => { ### style -用于配置几何体显示图像属性目前支持以下属性,其他属性会逐步开放 - -- fill +全局设置图形显示属性 - opacity   设置透明度 -- stroke 线填充颜色 +- stroke 线填充颜色 仅点图层支持 -- strokeWidth 线的宽度 +- strokeWidth 线的宽度 仅点图层支持 ```javascript layer.style({ - fill: 'red', opacity: 0.8, stroke: 'white', }); ``` +## 图层更新方法 + +如果已经添加了图层,需要修改图层显示样式可以再次调用图形映射方法,然后调用 `scene.render()`更新渲染即可 + +### 样式更新 + +```javascript +layer.color('blue'); +layer.size(10); +layer.style({}); +scene.render(); +``` + +### setData + +更新 Source 数据 + +参数: + +- data 数据 +- option 默认和初始配置项一致,如果数据格式相同可不设置 + +调用 setData 方法会自动更新图层渲染 + +```javascript +layer.setData(data); +``` + +### setBlend(type) + +设置图层叠加方法 +参数: + +- type blend 类型 + +## 图层控制方法 + ### show 图层显示 @@ -301,6 +324,16 @@ layer.show(); layer.hide(); ``` +### isVisable + +图层是否可见 + +return `true | false` + +### setIndex + +设置图层绘制顺序 + ### fitBounds 缩放到图层范围 @@ -308,3 +341,178 @@ layer.hide(); ```javascript layer.fitBounds(); ``` + +### setMinZoom + +### setMaxZoom + +## 图层交互方法 + +### active + +开启或者关闭 mousehover 元素高亮效果 + +参数: activeOption | boolean + +activeOption +-color 填充颜色 + +```javascript +// 开启 Active 使用默认高亮颜色 +layer.active(true); + +// 开启 Active 自定义高亮颜色 + +layer.active({ + color: 'red', +}); + +// 关闭高亮效果 +layer.active(false); +``` + +### setActive + +根据元素 ID 设置指定元素 hover 高亮 + +```javascript +layer.setActive(id); +``` + +### select + +开启或者关闭 mouseclick 元素选中高亮效果 + +参数: selectOption | boolean + +selectOption +-color 填充颜色 + +```javascript +// 开启 Active 使用默认高亮颜色 +layer.select(true); + +// 开启 Active 自定义高亮颜色 + +layer.select({ + color: 'red', +}); + +// 关闭高亮效果 +layer.select(false); +``` + +### setSelect + +根据元素 ID 设置指定元素 click 选中 高亮 + +```javascript +layer.setSelect(id); +``` + +## 鼠标事件 + +鼠标事件回调参数 target + +```typescript +``` + +- x: number 鼠标  在地图位置 x 坐标 +- y: number 鼠标  在地图位置 y 坐标 +- type: string 鼠标事件类型 +- lngLat: ILngLat {lng:number, lat: number }; 鼠标所在位置经纬度 +- feature: any; 数据选中的地理要素信息 +- featureId: number | null; 数据选中的地理要素的 ID + +### click + +点击事件 + +### mousemove + +鼠标移动事件 + +### mouseout + +鼠标移除 + +### mouseup + +鼠标按下 + +### mousedown + +鼠标向下 + +### contextmenu + +鼠标右键 + +### unclick + +点击未拾取到元素 + +### unmousemove + +鼠标移动未拾取到元素 + +### unmouseup + +鼠标抬起未拾取到元素 + +### unmousedown + +鼠标按下未拾取到元素 + +### uncontextmenu + +鼠标右键位拾取到元素 + +### unpick + +所有鼠标事件未拾取到 + +使用示例 + +```javascript +layer.on('click', (ev) => {}); // 鼠标左键点击图层事件 +layer.on('mousemove', (ev) => {}); // 鼠标在图层上移动时触发 +layer.on('mouseout', (ev) => {}); // 鼠标移出图层要素时触发 +layer.on('mouseup', (ev) => {}); // 鼠标在图层上单击抬起时触发 +layer.on('mousedown', (ev) => {}); // 鼠标在图层上单击按下时触发 +layer.on('contextmenu', (ev) => {}); // 图层要素点击右键菜单 + +// 鼠标在图层外的事件 +layer.on('unclick', (ev) => {}); // 图层外点击 +layer.on('unmousemove', (ev) => {}); // 图层外移动 +layer.on('unmouseup', (ev) => {}); // 图层外鼠标抬起 +layer.on('unmousedown', (ev) => {}); // 图层外单击按下时触发 +layer.on('uncontextmenu', (ev) => {}); // 图层外点击右键 +layer.on('unpick', (ev) => {}); // 图层外的操作的所有事件 +``` + +## 图层事件 + +### inited +option +- target ILayer 当前layer +- type 事件类型 + + +图层初始化完成后触发 + +### add +图层添加到scene + +option +- target ILayer 当前layer +- type 事件类型 + + +### remove + +图层移除时触发 + +option +- target ILayer 当前layer +- type 事件类型 diff --git a/docs/api/layer/layer.zh.md b/docs/api/layer/layer.zh.md index 609129b134..908a7389cb 100644 --- a/docs/api/layer/layer.zh.md +++ b/docs/api/layer/layer.zh.md @@ -494,9 +494,25 @@ layer.on('unpick', (ev) => {}); // 图层外的操作的所有事件 ## 图层事件 ### inited +option +- target ILayer 当前layer +- type 事件类型 + 图层初始化完成后触发 +### add +图层添加到scene + +option +- target ILayer 当前layer +- type 事件类型 + + ### remove 图层移除时触发 + +option +- target ILayer 当前layer +- type 事件类型 diff --git a/gatsby-config.js b/gatsby-config.js index 27d8be0234..d8ca9b9665 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -220,7 +220,7 @@ module.exports = { playground: { container: '
', dependencies: { - '@antv/l7': 'beta', + '@antv/l7': 'latest', '@antv/l7-maps': 'latest' } }, diff --git a/packages/core/src/services/log/LogService.ts b/packages/core/src/services/log/LogService.ts index 533e2d2145..4d0e4e84e3 100644 --- a/packages/core/src/services/log/LogService.ts +++ b/packages/core/src/services/log/LogService.ts @@ -1,8 +1,7 @@ import { injectable } from 'inversify'; import Probe, { Log } from 'probe.gl'; import { ILogService } from './ILogService'; -console.log(process.env.NODE_ENV) -const Logger = new Log({ id: 'L7' }).enable(true); +const Logger = new Log({ id: 'L7' }).enable(false); // // 只输出 debug 级别以上的日志信息 Logger.priority = 5; diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index 59b392d698..85d5e58fdb 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -304,8 +304,14 @@ export default class BaseLayer extends EventEmitter this.hooks.afterInit.call(); // 触发初始化完成事件; - this.emit('inited'); - this.emit('added'); + this.emit('inited', { + target: this, + type: 'inited', + }); + this.emit('add', { + target: this, + type: 'add', + }); return this; } /** @@ -659,6 +665,11 @@ export default class BaseLayer extends EventEmitter this.hooks.afterDestroy.call(); + this.emit('remove', { + target: this, + type: 'remove', + }); + this.removeAllListeners(); // 解绑图层容器中的服务