diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a83c096c9..ca2d178d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +### Bug Fixes + +- 3d 热力图抖动问题 fixes [#138](https://github.com/antvis/L7/issues/138) [#263](https://github.com/antvis/L7/issues/263) ([d56e8d6](https://github.com/antvis/L7/commit/d56e8d6205942ca12fa7ac3dfd226aecbb850ed2)) +- 拾取 invalid x offset ([8282007](https://github.com/antvis/L7/commit/82820077f40998e156337b266623309eff6b2d60)) + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) ### Bug Fixes diff --git a/lerna.json b/lerna.json index 486a66101b..472f41be03 100644 --- a/lerna.json +++ b/lerna.json @@ -14,7 +14,7 @@ "message": "chore: publish" } }, - "version": "2.1.7", + "version": "2.1.8", "npmClient": "yarn", "useWorkspaces": true, "publishConfig": { diff --git a/packages/component/CHANGELOG.md b/packages/component/CHANGELOG.md index c1b26330cb..2bf9ffc24a 100644 --- a/packages/component/CHANGELOG.md +++ b/packages/component/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7-component + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7-component diff --git a/packages/component/package.json b/packages/component/package.json index 9be3ea7a9c..a687f01684 100644 --- a/packages/component/package.json +++ b/packages/component/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-component", - "version": "2.1.7", + "version": "2.1.8", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -24,8 +24,8 @@ "author": "lzxue", "license": "ISC", "dependencies": { - "@antv/l7-core": "^2.1.7", - "@antv/l7-utils": "^2.1.7", + "@antv/l7-core": "^2.1.8", + "@antv/l7-utils": "^2.1.8", "@babel/runtime": "^7.7.7", "eventemitter3": "^4.0.0", "inversify": "^5.0.1", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 3d544c678a..680fff34df 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + + +### Bug Fixes + +* 拾取 invalid x offset ([8282007](https://github.com/antvis/L7/commit/82820077f40998e156337b266623309eff6b2d60)) + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7-core diff --git a/packages/core/package.json b/packages/core/package.json index 3f17155fd9..68ebf82247 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-core", - "version": "2.1.7", + "version": "2.1.8", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -23,7 +23,7 @@ "license": "ISC", "dependencies": { "@antv/async-hook": "^2.1.0", - "@antv/l7-utils": "^2.1.7", + "@antv/l7-utils": "^2.1.8", "@babel/runtime": "^7.7.7", "@mapbox/tiny-sdf": "^1.1.1", "ajv": "^6.10.2", diff --git a/packages/core/src/services/config/ConfigService.ts b/packages/core/src/services/config/ConfigService.ts index cc96c1ec46..b5f6642490 100644 --- a/packages/core/src/services/config/ConfigService.ts +++ b/packages/core/src/services/config/ConfigService.ts @@ -4,8 +4,6 @@ import { merge } from 'lodash'; import { ILayerConfig } from '../layer/ILayerService'; import { IRenderConfig } from '../renderer/IRendererService'; import { IGlobalConfigService, ISceneConfig } from './IConfigService'; -import mapConfigSchema from './mapConfigSchema'; -import sceneConfigSchema from './sceneConfigSchema'; import WarnInfo, { IWarnInfo } from './warnInfo'; /** @@ -17,6 +15,9 @@ const defaultSceneConfig: Partial = { logoVisible: true, antialias: true, preserveDrawingBuffer: false, + fitBoundsOptions: { + animate: false, + }, }; /** diff --git a/packages/core/src/services/config/IConfigService.ts b/packages/core/src/services/config/IConfigService.ts index 6c5d2bda2d..a7aab39e48 100644 --- a/packages/core/src/services/config/IConfigService.ts +++ b/packages/core/src/services/config/IConfigService.ts @@ -8,6 +8,8 @@ export interface ISceneConfig extends IRenderConfig { map: IMapWrapper; logoPosition?: PositionName; logoVisible?: boolean; + animate?: boolean; + fitBoundsOptions?: unknown; } // interface IValidateResult { diff --git a/packages/core/src/services/layer/ILayerService.ts b/packages/core/src/services/layer/ILayerService.ts index 1f502cbfe8..4e6270e447 100644 --- a/packages/core/src/services/layer/ILayerService.ts +++ b/packages/core/src/services/layer/ILayerService.ts @@ -155,7 +155,7 @@ export interface ILayer { destroy(): void; source(data: any, option?: ISourceCFG): ILayer; setData(data: any, option?: ISourceCFG): ILayer; - fitBounds(): ILayer; + fitBounds(fitBoundsOptions?: unknown): ILayer; /** * 向当前图层注册插件 * @param plugin 插件实例 @@ -224,6 +224,7 @@ export interface ILayerConfig { pickingBuffer: number; enablePropagation: boolean; autoFit: boolean; + fitBoundsOptions?: unknown; name: string; // blend: keyof typeof BlendType; pickedFeatureID: number; diff --git a/packages/core/src/services/map/IMapService.ts b/packages/core/src/services/map/IMapService.ts index e3d6bbf8e6..0bbed1820a 100644 --- a/packages/core/src/services/map/IMapService.ts +++ b/packages/core/src/services/map/IMapService.ts @@ -11,6 +11,15 @@ export interface IPoint { y: number; } +export interface IStatusOptions { + showIndoorMap: boolean; + resizeEnable: boolean; + dragEnable: boolean; + keyboardEnable: boolean; + doubleClickZoom: boolean; + zoomEnable: boolean; + rotateEnable: boolean; +} export type MapStyle = string | { [key: string]: any }; export interface IMapWrapper { setContainer(container: Container, id: string | HTMLDivElement): void; @@ -50,12 +59,13 @@ export interface IMapService { zoomOut(option?: any, eventData?: any): void; panTo(p: Point): void; panBy(pixel: Point): void; - fitBounds(bound: Bounds): void; + fitBounds(bound: Bounds, fitBoundsOptions?: unknown): void; setZoomAndCenter(zoom: number, center: Point): void; setCenter(center: [number, number]): void; setPitch(pitch: number): void; setZoom(zoom: number): void; setMapStyle(style: any): void; + setStatus(option: Partial): void; // coordinates methods pixelToLngLat(pixel: Point): ILngLat; diff --git a/packages/draw/CHANGELOG.md b/packages/draw/CHANGELOG.md index 1526896b5b..cedb343895 100644 --- a/packages/draw/CHANGELOG.md +++ b/packages/draw/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7-draw + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7-draw diff --git a/packages/draw/package.json b/packages/draw/package.json index 5e918bae57..97e1d5385f 100644 --- a/packages/draw/package.json +++ b/packages/draw/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-draw", - "version": "2.1.7", + "version": "2.1.8", "description": "L7 Draw moudules", "keywords": [], "author": "thinkinggis ", @@ -33,8 +33,8 @@ "test": "jest" }, "dependencies": { - "@antv/l7": "^2.1.7", "@turf/midpoint": "^5.1.5", + "@antv/l7": "^2.1.8", "@babel/runtime": "^7.7.7", "@turf/circle": "^6.0.1", "@turf/distance": "^6.0.1", diff --git a/packages/l7/CHANGELOG.md b/packages/l7/CHANGELOG.md index 30a6461117..ae04f38f0f 100644 --- a/packages/l7/CHANGELOG.md +++ b/packages/l7/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7 + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7 diff --git a/packages/l7/package.json b/packages/l7/package.json index 244a0ab7f9..6326bc7145 100644 --- a/packages/l7/package.json +++ b/packages/l7/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7", - "version": "2.1.7", + "version": "2.1.8", "description": "A Large-scale WebGL-powered Geospatial Data Visualization", "main": "lib/index.js", "module": "es/index.js", @@ -24,11 +24,11 @@ "author": "antv", "license": "MIT", "dependencies": { - "@antv/l7-component": "^2.1.7", - "@antv/l7-core": "^2.1.7", - "@antv/l7-layers": "^2.1.7", - "@antv/l7-maps": "^2.1.7", - "@antv/l7-scene": "^2.1.7", + "@antv/l7-component": "^2.1.8", + "@antv/l7-core": "^2.1.8", + "@antv/l7-layers": "^2.1.8", + "@antv/l7-maps": "^2.1.8", + "@antv/l7-scene": "^2.1.8", "@babel/runtime": "^7.7.7" }, "gitHead": "a5d354b66873f700730248d015c5e539c54b34b7", diff --git a/packages/l7/src/index.ts b/packages/l7/src/index.ts index 53d728fe0c..7a6ae4533d 100644 --- a/packages/l7/src/index.ts +++ b/packages/l7/src/index.ts @@ -3,4 +3,4 @@ export * from '@antv/l7-scene'; export * from '@antv/l7-maps'; export * from '@antv/l7-layers'; export * from '@antv/l7-component'; -export const version = '2.1.6'; +export const version = '2.1.8'; diff --git a/packages/layers/CHANGELOG.md b/packages/layers/CHANGELOG.md index 516db9d0f4..2839106d3c 100644 --- a/packages/layers/CHANGELOG.md +++ b/packages/layers/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + + +### Bug Fixes + +* 3d 热力图抖动问题 fixes [#138](https://github.com/antvis/L7/issues/138) [#263](https://github.com/antvis/L7/issues/263) ([d56e8d6](https://github.com/antvis/L7/commit/d56e8d6205942ca12fa7ac3dfd226aecbb850ed2)) + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) diff --git a/packages/layers/package.json b/packages/layers/package.json index 56865f55f6..2c876ba984 100644 --- a/packages/layers/package.json +++ b/packages/layers/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-layers", - "version": "2.1.7", + "version": "2.1.8", "description": "L7's collection of built-in layers", "main": "lib/index.js", "module": "es/index.js", @@ -23,9 +23,9 @@ "license": "ISC", "dependencies": { "@antv/async-hook": "^2.1.0", - "@antv/l7-core": "^2.1.7", - "@antv/l7-source": "^2.1.7", - "@antv/l7-utils": "^2.1.7", + "@antv/l7-core": "^2.1.8", + "@antv/l7-source": "^2.1.8", + "@antv/l7-utils": "^2.1.8", "@babel/runtime": "^7.7.7", "@mapbox/martini": "^0.1.0", "@turf/meta": "^6.0.2", diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index 3c81745726..ec5eee969e 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -654,7 +654,7 @@ export default class BaseLayer extends EventEmitter /** * zoom to layer Bounds */ - public fitBounds(): ILayer { + public fitBounds(fitBoundsOptions?: unknown): ILayer { if (!this.inited) { this.updateLayerConfig({ autoFit: true, @@ -663,10 +663,13 @@ export default class BaseLayer extends EventEmitter } const source = this.getSource(); const extent = source.extent; - this.mapService.fitBounds([ - [extent[0], extent[1]], - [extent[2], extent[3]], - ]); + this.mapService.fitBounds( + [ + [extent[0], extent[1]], + [extent[2], extent[3]], + ], + fitBoundsOptions, + ); return this; } @@ -879,9 +882,9 @@ export default class BaseLayer extends EventEmitter private sourceEvent = () => { this.dataState.dataSourceNeedUpdate = true; - const { autoFit } = this.getLayerConfig(); + const { autoFit, fitBoundsOptions } = this.getLayerConfig(); if (autoFit) { - this.fitBounds(); + this.fitBounds(fitBoundsOptions); } this.emit('dataUpdate'); diff --git a/packages/layers/src/plugins/LayerStylePlugin.ts b/packages/layers/src/plugins/LayerStylePlugin.ts index d91d42571c..140cfb41f0 100644 --- a/packages/layers/src/plugins/LayerStylePlugin.ts +++ b/packages/layers/src/plugins/LayerStylePlugin.ts @@ -11,10 +11,10 @@ export default class LayerStylePlugin implements ILayerPlugin { layer.hooks.afterInit.tap('LayerStylePlugin', () => { // 更新图层默认状态 layer.updateLayerConfig({}); - const { autoFit } = layer.getLayerConfig(); + const { autoFit, fitBoundsOptions } = layer.getLayerConfig(); if (autoFit) { setTimeout(() => { - layer.fitBounds(); + layer.fitBounds(fitBoundsOptions); }, 100); } }); diff --git a/packages/maps/CHANGELOG.md b/packages/maps/CHANGELOG.md index b7e698dc17..1e016d2a74 100644 --- a/packages/maps/CHANGELOG.md +++ b/packages/maps/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7-maps + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7-maps diff --git a/packages/maps/package.json b/packages/maps/package.json index e55171163e..f554633540 100644 --- a/packages/maps/package.json +++ b/packages/maps/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-maps", - "version": "2.1.7", + "version": "2.1.8", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -25,8 +25,8 @@ "author": "xiaoiver", "license": "ISC", "dependencies": { - "@antv/l7-core": "^2.1.7", - "@antv/l7-utils": "^2.1.7", + "@antv/l7-core": "^2.1.8", + "@antv/l7-utils": "^2.1.8", "@babel/runtime": "^7.7.7", "@types/amap-js-api": "^1.4.6", "gl-matrix": "^3.1.0", diff --git a/packages/maps/src/amap/map.ts b/packages/maps/src/amap/map.ts index 25dab7cb57..d28ff9bc3b 100644 --- a/packages/maps/src/amap/map.ts +++ b/packages/maps/src/amap/map.ts @@ -11,6 +11,7 @@ import { IMapConfig, IMapService, IPoint, + IStatusOptions, IViewport, MapServiceEvent, MapStyle, @@ -201,6 +202,10 @@ export default class AMapService public setMapStyle(style: string): void { this.map.setMapStyle(this.getMapStyle(style)); } + + public setStatus(option: Partial) { + this.map.setStatus(option); + } public pixelToLngLat(pixel: [number, number]): ILngLat { const lngLat = this.map.pixelToLngLat(new AMap.Pixel(pixel[0], pixel[1])); return { lng: lngLat.getLng(), lat: lngLat.getLat() }; diff --git a/packages/maps/src/mapbox/map.ts b/packages/maps/src/mapbox/map.ts index 6e41550c0a..8db2ed07da 100644 --- a/packages/maps/src/mapbox/map.ts +++ b/packages/maps/src/mapbox/map.ts @@ -11,6 +11,7 @@ import { IMapConfig, IMapService, IPoint, + IStatusOptions, IViewport, MapServiceEvent, MapStyle, @@ -155,8 +156,8 @@ export default class MapboxService this.panTo(pixel); } - public fitBounds(bound: Bounds): void { - this.map.fitBounds(bound); + public fitBounds(bound: Bounds, fitBoundsOptions?: unknown): void { + this.map.fitBounds(bound, fitBoundsOptions as mapboxgl.FitBoundsOptions); } public setMaxZoom(max: number): void { @@ -166,6 +167,38 @@ export default class MapboxService public setMinZoom(min: number): void { this.map.setMinZoom(min); } + public setStatus(option: Partial) { + if (option.doubleClickZoom === true) { + this.map.doubleClickZoom.enable(); + } + if (option.doubleClickZoom === false) { + this.map.doubleClickZoom.disable(); + } + if (option.dragEnable === false) { + this.map.dragPan.disable(); + } + if (option.dragEnable === true) { + this.map.dragPan.enable(); + } + if (option.rotateEnable === false) { + this.map.dragRotate.disable(); + } + if (option.dragEnable === true) { + this.map.dragRotate.enable(); + } + if (option.keyboardEnable === false) { + this.map.keyboard.disable(); + } + if (option.keyboardEnable === true) { + this.map.keyboard.enable(); + } + if (option.zoomEnable === false) { + this.map.scrollZoom.disable(); + } + if (option.zoomEnable === true) { + this.map.scrollZoom.enable(); + } + } public setZoomAndCenter(zoom: number, center: [number, number]): void { this.map.flyTo({ diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index f79a73eceb..c7604cdc39 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7-react + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7-react diff --git a/packages/react/package.json b/packages/react/package.json index dde9876025..6234e6fc48 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-react", - "version": "2.1.7", + "version": "2.1.8", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -24,8 +24,8 @@ "author": "lzxue", "license": "ISC", "dependencies": { - "@antv/l7": "^2.1.7", - "@antv/l7-maps": "^2.1.7", + "@antv/l7": "^2.1.8", + "@antv/l7-maps": "^2.1.8", "@babel/runtime": "^7.7.7", "load-styles": "^2.0.0" }, diff --git a/packages/react/src/component/LayerAttribute/Layer.tsx b/packages/react/src/component/LayerAttribute/Layer.tsx index e122727df1..a90a30ee39 100644 --- a/packages/react/src/component/LayerAttribute/Layer.tsx +++ b/packages/react/src/component/LayerAttribute/Layer.tsx @@ -113,12 +113,6 @@ export default function BaseLayer(type: string, props: ILayerProps) { } }, [options?.blend]); - // useEffect(() => { - // if (layer && layer.inited && options && options.autoFit === true) { - // layer.fitBounds(); - // } - // }, [options?.autoFit]); - return layer !== null && layer !== undefined ? ( diff --git a/packages/react/src/component/LayerAttribute/Source.tsx b/packages/react/src/component/LayerAttribute/Source.tsx index df42b23261..1272fee859 100644 --- a/packages/react/src/component/LayerAttribute/Source.tsx +++ b/packages/react/src/component/LayerAttribute/Source.tsx @@ -18,7 +18,7 @@ export default React.memo(function Chart(props: ISourceProps) { layer.setData(data, sourceOption); } if (sourceOption.autoFit) { - layer.fitBounds(); + layer.fitBounds(sourceOption && sourceOption.fitBoundsOptions); } }, [data, JSON.stringify(sourceOption)]); return null; diff --git a/packages/react/src/component/LayerAttribute/index.ts b/packages/react/src/component/LayerAttribute/index.ts index 9cf6719a5d..c182616659 100644 --- a/packages/react/src/component/LayerAttribute/index.ts +++ b/packages/react/src/component/LayerAttribute/index.ts @@ -60,6 +60,8 @@ export interface ISourceOptions extends ISourceCFG { data: any; // 每次更新数据之后是否自适应缩放 autoFit?: boolean; + // Mapbox 自适应的参数 + fitBoundsOptions?: any; } export interface IActiveOptions { diff --git a/packages/renderer/CHANGELOG.md b/packages/renderer/CHANGELOG.md index d095d840b4..009a95becf 100644 --- a/packages/renderer/CHANGELOG.md +++ b/packages/renderer/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7-renderer + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7-renderer diff --git a/packages/renderer/package.json b/packages/renderer/package.json index 2765866cfa..2379da1b7f 100644 --- a/packages/renderer/package.json +++ b/packages/renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-renderer", - "version": "2.1.7", + "version": "2.1.8", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -25,7 +25,7 @@ "gl": "^4.4.0" }, "dependencies": { - "@antv/l7-core": "^2.1.7", + "@antv/l7-core": "^2.1.8", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "lodash": "^4.17.15", diff --git a/packages/scene/CHANGELOG.md b/packages/scene/CHANGELOG.md index 7e963e68b0..c1ce3d3f2a 100644 --- a/packages/scene/CHANGELOG.md +++ b/packages/scene/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7-scene + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7-scene diff --git a/packages/scene/package.json b/packages/scene/package.json index b8ade1a6be..0e42df8cfe 100644 --- a/packages/scene/package.json +++ b/packages/scene/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-scene", - "version": "2.1.7", + "version": "2.1.8", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -22,11 +22,11 @@ "author": "xiaoiver", "license": "ISC", "dependencies": { - "@antv/l7-component": "^2.1.7", - "@antv/l7-core": "^2.1.7", - "@antv/l7-maps": "^2.1.7", - "@antv/l7-renderer": "^2.1.7", - "@antv/l7-utils": "^2.1.7", + "@antv/l7-component": "^2.1.8", + "@antv/l7-core": "^2.1.8", + "@antv/l7-maps": "^2.1.8", + "@antv/l7-renderer": "^2.1.8", + "@antv/l7-utils": "^2.1.8", "@babel/runtime": "^7.7.7", "inversify": "^5.0.1", "mapbox-gl": "^1.2.1", diff --git a/packages/scene/src/IMapController.ts b/packages/scene/src/IMapController.ts index e1174a1e63..b38f9de3ed 100644 --- a/packages/scene/src/IMapController.ts +++ b/packages/scene/src/IMapController.ts @@ -1,4 +1,4 @@ -import { Bounds, ILngLat, IPoint, Point } from '@antv/l7-core'; +import { Bounds, ILngLat, IPoint, IStatusOptions, Point } from '@antv/l7-core'; export default interface IMapController { /** @@ -49,19 +49,30 @@ export default interface IMapController { /** * 调整地图适合指定区域 */ - fitBounds(bound: Bounds): void; + fitBounds(bound: Bounds, fitBoundsOptions?: unknown): void; + getContainer(): HTMLElement | null; + getSize(): [number, number]; + // get map status method + getMinZoom(): number; + getMaxZoom(): number; + // get map params + getType(): string; + getMapContainer(): HTMLElement | null; + + // control with raw map setRotation(rotation: number): void; - setZoomAndCenter(zoom: number, center: Point): void; + setCenter(center: [number, number]): void; + setPitch(pitch: number): void; + setZoom(zoom: number): void; + setMapStyle(style: any): void; + setStatus(option: Partial): void; - setMapStyle(style: string): void; - + // coordinates methods pixelToLngLat(pixel: Point): ILngLat; - lngLatToPixel(lnglat: Point): IPoint; - containerToLngLat(pixel: Point): ILngLat; - lngLatToContainer(lnglat: Point): IPoint; + exportMap(type: 'jpg' | 'png'): string; } diff --git a/packages/scene/src/index.ts b/packages/scene/src/index.ts index 4ae767867e..b26c9cb8b6 100644 --- a/packages/scene/src/index.ts +++ b/packages/scene/src/index.ts @@ -24,6 +24,7 @@ import { IRendererService, ISceneConfig, ISceneService, + IStatusOptions, Point, SceneEventList, TYPES, @@ -58,11 +59,10 @@ class Scene private popupService: IPopupService; private fontService: IFontService; private interactionService: IInteractionService; - private container: Container; public constructor(config: ISceneConfig) { - const { id, map, logoPosition, logoVisible = true } = config; + const { id, map } = config; // 创建场景容器 const sceneContainer = createSceneContainer(); this.container = sceneContainer; @@ -103,6 +103,21 @@ class Scene this.initControl(); } + public getSize(): [number, number] { + return this.mapService.getSize(); + } + public getMinZoom(): number { + return this.mapService.getMinZoom(); + } + public getMaxZoom(): number { + return this.mapService.getMaxZoom(); + } + public getType(): string { + return this.mapService.getType(); + } + public getMapContainer(): HTMLElement | null { + return this.mapService.getMapContainer(); + } public getMapService(): IMapService { return this.mapService; @@ -270,8 +285,16 @@ class Scene public setZoom(zoom: number): void { this.mapService.setZoom(zoom); } - public fitBounds(bound: Bounds): void { - this.mapService.fitBounds(bound); + public fitBounds(bound: Bounds, options?: unknown): void { + const { fitBoundsOptions, animate } = this.sceneService.getSceneConfig(); + this.mapService.fitBounds( + bound, + // 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入 + options || { + ...(fitBoundsOptions as object), + animate, + }, + ); } public setZoomAndCenter(zoom: number, center: Point): void { @@ -282,6 +305,10 @@ class Scene this.mapService.setMapStyle(style); } + public setStatus(options: IStatusOptions) { + this.mapService.setStatus(options); + } + // conversion Method public pixelToLngLat(pixel: Point): ILngLat { return this.mapService.pixelToLngLat(pixel); diff --git a/packages/source/CHANGELOG.md b/packages/source/CHANGELOG.md index cab3d3b3f0..ba11bb5c51 100644 --- a/packages/source/CHANGELOG.md +++ b/packages/source/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7-source + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) **Note:** Version bump only for package @antv/l7-source diff --git a/packages/source/package.json b/packages/source/package.json index 04ef2afa91..149cb66a36 100644 --- a/packages/source/package.json +++ b/packages/source/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-source", - "version": "2.1.7", + "version": "2.1.8", "description": "", "main": "lib/index.js", "module": "es/index.js", @@ -25,8 +25,8 @@ "license": "ISC", "dependencies": { "@antv/async-hook": "^2.1.0", - "@antv/l7-core": "^2.1.7", - "@antv/l7-utils": "^2.1.7", + "@antv/l7-core": "^2.1.8", + "@antv/l7-utils": "^2.1.8", "@babel/runtime": "^7.7.7", "@mapbox/geojson-rewind": "^0.4.0", "@turf/helpers": "^6.1.4", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index cc6b17d6a5..b4ebc38efe 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26) + +**Note:** Version bump only for package @antv/l7-utils + + + + + ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26) diff --git a/packages/utils/package.json b/packages/utils/package.json index 5c074cc797..c29b1afec3 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7-utils", - "version": "2.1.7", + "version": "2.1.8", "description": "", "main": "lib/index.js", "module": "es/index.js", diff --git a/stories/React/components/world_ncov_fill.tsx b/stories/React/components/world_ncov_fill.tsx index 2852dbcaf3..b027d48274 100644 --- a/stories/React/components/world_ncov_fill.tsx +++ b/stories/React/components/world_ncov_fill.tsx @@ -85,7 +85,7 @@ export default React.memo(function Map() { center: [110.19382669582967, 50.258134], pitch: 0, style: 'blank', - zoom: 1, + zoom: 10, }} style={{ position: 'absolute', @@ -100,6 +100,10 @@ export default React.memo(function Map() { key={'1'} options={{ autoFit: true, + fitBoundsOptions: { + duration: 0, + animate: false, + }, }} source={{ data,