From 0e5aad2b129fa68b6dbf730e7fa877fe3df2ade4 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Sat, 3 Jul 2021 22:50:25 +0800 Subject: [PATCH 1/3] fix: lint error --- packages/core/src/services/layer/IStyleAttributeService.ts | 2 +- packages/layers/src/core/BaseLayer.ts | 7 +++---- packages/layers/src/plugins/FeatureScalePlugin.ts | 2 +- packages/three/rollup.config.js | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/core/src/services/layer/IStyleAttributeService.ts b/packages/core/src/services/layer/IStyleAttributeService.ts index 115a25c332..2bfd8844d4 100644 --- a/packages/core/src/services/layer/IStyleAttributeService.ts +++ b/packages/core/src/services/layer/IStyleAttributeService.ts @@ -60,7 +60,7 @@ export interface IScaleOption { domain?: any[]; } export interface IScaleOptions { - [key: string]: IScale; + [key: string]: IScale | undefined; } export interface IStyleScale { scale: any; diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index e7874c734d..df421af558 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -229,7 +229,7 @@ export default class BaseLayer extends EventEmitter return this.container; } - public addPlugin(plugin: ILayerPlugin) { + public addPlugin(plugin: ILayerPlugin): ILayer { // TODO: 控制插件注册顺序 // @example: // pointLayer.addPlugin(new MyCustomPlugin(), { @@ -457,7 +457,6 @@ export default class BaseLayer extends EventEmitter }; return this; } - public setData(data: any, options?: ISourceCFG) { if (this.inited) { this.layerSource.setData(data, options); @@ -498,7 +497,7 @@ export default class BaseLayer extends EventEmitter } return this; } - public scale(field: string | IScaleOptions, cfg: IScale) { + public scale(field: string | number | IScaleOptions, cfg?: IScale) { if (isObject(field)) { this.scaleOptions = { ...this.scaleOptions, @@ -528,7 +527,7 @@ export default class BaseLayer extends EventEmitter return this; } - public active(options: IActiveOption) { + public active(options: IActiveOption | boolean) { const activeOption: Partial = {}; activeOption.enableHighlight = isObject(options) ? true : options; if (isObject(options)) { diff --git a/packages/layers/src/plugins/FeatureScalePlugin.ts b/packages/layers/src/plugins/FeatureScalePlugin.ts index 3819a5f008..a39667f8e7 100644 --- a/packages/layers/src/plugins/FeatureScalePlugin.ts +++ b/packages/layers/src/plugins/FeatureScalePlugin.ts @@ -209,7 +209,7 @@ export default class FeatureScalePlugin implements ILayerPlugin { ): IStyleScale { // scale 支持根据视觉通道和字段 const scaleOption: IScale | undefined = - this.scaleOptions[name] && this.scaleOptions[name].field === field + this.scaleOptions[name] && this.scaleOptions[name]?.field === field ? this.scaleOptions[name] : this.scaleOptions[field]; const styleScale: IStyleScale = { diff --git a/packages/three/rollup.config.js b/packages/three/rollup.config.js index 3cf5c14107..1090c3a46a 100644 --- a/packages/three/rollup.config.js +++ b/packages/three/rollup.config.js @@ -26,11 +26,11 @@ export default { namedExports: { eventemitter3: [ 'EventEmitter' ], lodash: [ 'merge' ], - // inversify: ['inject','injectable'] + inversify: [ 'inject', 'injectable' ] }, dynamicRequireTargets: [ - 'node_modules/inversify/lib/syntax/binding_{on,when}_syntax.js', - ], + 'node_modules/inversify/lib/syntax/binding_{on,when}_syntax.js' + ] }), buble({ transforms: { generator: false } From 991ee533af953487a9badd8c08c18a822393c0cd Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Sat, 3 Jul 2021 23:00:24 +0800 Subject: [PATCH 2/3] fix: rollup --- build/rollup.config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/rollup.config.js b/build/rollup.config.js index 3d2e80c3d0..91273a7dcd 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -43,11 +43,11 @@ module.exports = [ entries: [ { find: /^@antv\/l7-(.*)/, - replacement: resolveFile('packages/$1/src'), + replacement: resolveFile('packages/$1/src') }, { find: /^@antv\/l7$/, - replacement: resolveFile('packages/l7/src'), + replacement: resolveFile('packages/l7/src') } ] } @@ -72,7 +72,7 @@ module.exports = [ commonjs({ namedExports: { eventemitter3: [ 'EventEmitter' ], - // inversify: ['inject','injectable','postConstruct','Container','decorate','interfaces'], + inversify: [ 'inject', 'injectable', 'postConstruct', 'Container', 'decorate', 'interfaces' ], // @see https://github.com/rollup/rollup-plugin-commonjs/issues/266 lodash: [ 'isNil', @@ -87,8 +87,8 @@ module.exports = [ ] }, dynamicRequireTargets: [ - 'node_modules/inversify/lib/syntax/binding_{on,when}_syntax.js', - ], + 'node_modules/inversify/lib/syntax/binding_{on,when}_syntax.js' + ] }), babel({ extensions: [ '.js', '.ts' ] From 27eb839128b227795b70cbd9b027938327742ca1 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Tue, 13 Jul 2021 20:36:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E9=AB=98=E5=BE=B7=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?v2=E6=94=AF=E6=8C=81=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/maps/src/amap2/map.ts | 3 ++- stories/Map/components/amap2demo_arcLineLinear.tsx | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/maps/src/amap2/map.ts b/packages/maps/src/amap2/map.ts index 6d170c1e52..c760f32f43 100644 --- a/packages/maps/src/amap2/map.ts +++ b/packages/maps/src/amap2/map.ts @@ -403,6 +403,7 @@ export default class AMapService token = AMAP_API_KEY, mapInstance, plugin = [], + version = AMAP_VERSION, ...rest } = this.config; // 高德地图创建独立的container; @@ -464,7 +465,7 @@ export default class AMapService plugin.push('Map3D'); AMapLoader.load({ key: token, // 申请好的Web端开发者Key,首次调用 load 时必填 - version: AMAP_VERSION, // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 + version, // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 plugins: plugin, // 需要使用的的插件列表,如比例尺'AMap.Scale'等 }) .then((AMap) => { diff --git a/stories/Map/components/amap2demo_arcLineLinear.tsx b/stories/Map/components/amap2demo_arcLineLinear.tsx index fef2b90fd7..15e68bc38f 100644 --- a/stories/Map/components/amap2demo_arcLineLinear.tsx +++ b/stories/Map/components/amap2demo_arcLineLinear.tsx @@ -1,5 +1,5 @@ import { LineLayer, Scene } from '@antv/l7'; -import { GaodeMap } from '@antv/l7-maps'; +import { GaodeMapV2 } from '@antv/l7-maps'; import * as React from 'react'; export default class Amap2demo_arcLineLinear extends React.Component { @@ -13,12 +13,13 @@ export default class Amap2demo_arcLineLinear extends React.Component { public async componentDidMount() { const scene = new Scene({ id: 'map', - map: new GaodeMap({ + map: new GaodeMapV2({ pitch: 40, center: [107.77791556935472, 35.443286920228644], zoom: 2.9142882493605033, viewMode: '3D', style: 'dark', + version: '2.0.4', }), }); this.scene = scene;