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 */