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' ] 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 988fb5e09c..97a2329a7b 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -234,7 +234,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(), { @@ -462,7 +462,6 @@ export default class BaseLayer extends EventEmitter }; return this; } - public setData(data: any, options?: ISourceCFG) { if (this.inited) { this.layerSource.setData(data, options); @@ -503,7 +502,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, @@ -533,7 +532,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/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/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 } 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;