From a7809465524e15c32f167a5d25916c39fa05da5d Mon Sep 17 00:00:00 2001 From: YiQianYao <42212176+2912401452@users.noreply.github.com> Date: Thu, 3 Mar 2022 16:21:18 +0800 Subject: [PATCH] Shihui (#990) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 新增 setAutoFit 方法,允许设置图层的 autoFit 属性值 * feat: 补充 setAutoFit 方法的返回值 --- packages/core/src/services/layer/ILayerService.ts | 1 + packages/layers/src/core/BaseLayer.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/packages/core/src/services/layer/ILayerService.ts b/packages/core/src/services/layer/ILayerService.ts index 8464856b3c..8a59868be0 100644 --- a/packages/core/src/services/layer/ILayerService.ts +++ b/packages/core/src/services/layer/ILayerService.ts @@ -200,6 +200,7 @@ export interface ILayer { id: number | { x: number; y: number }, option?: IActiveOption, ): void; + setAutoFit(autoFit: boolean): void; style(options: unknown): ILayer; hide(): ILayer; show(): ILayer; diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index db2054dcaf..da5b284527 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -795,6 +795,14 @@ export default class BaseLayer extends EventEmitter }); return this; } + + public setAutoFit(autoFit: boolean): ILayer { + this.updateLayerConfig({ + autoFit, + }); + return this; + } + /** * zoom to layer Bounds */