mirror of https://gitee.com/antv-l7/antv-l7
fix: mapboxgl.FitBoundsOptions类型替换成unknown
This commit is contained in:
parent
9048bcde8d
commit
aad0b365e3
|
@ -9,7 +9,7 @@ export interface ISceneConfig extends IRenderConfig {
|
|||
logoPosition?: PositionName;
|
||||
logoVisible?: boolean;
|
||||
animate?: boolean;
|
||||
fitBoundsOptions?: mapboxgl.FitBoundsOptions;
|
||||
fitBoundsOptions?: unknown;
|
||||
}
|
||||
|
||||
// interface IValidateResult {
|
||||
|
|
|
@ -155,7 +155,7 @@ export interface ILayer {
|
|||
destroy(): void;
|
||||
source(data: any, option?: ISourceCFG): ILayer;
|
||||
setData(data: any, option?: ISourceCFG): ILayer;
|
||||
fitBounds(fitBoundsOptions?: mapboxgl.FitBoundsOptions): ILayer;
|
||||
fitBounds(fitBoundsOptions?: unknown): ILayer;
|
||||
/**
|
||||
* 向当前图层注册插件
|
||||
* @param plugin 插件实例
|
||||
|
@ -222,7 +222,7 @@ export interface ILayerConfig {
|
|||
visible: boolean;
|
||||
zIndex: number;
|
||||
autoFit: boolean;
|
||||
fitBoundsOptions?: mapboxgl.FitBoundsOptions;
|
||||
fitBoundsOptions?: unknown;
|
||||
name: string; //
|
||||
blend: keyof typeof BlendType;
|
||||
pickedFeatureID: number;
|
||||
|
|
|
@ -50,7 +50,7 @@ export interface IMapService<RawMap = {}> {
|
|||
zoomOut(): void;
|
||||
panTo(p: Point): void;
|
||||
panBy(pixel: Point): void;
|
||||
fitBounds(bound: Bounds, fitBoundsOptions?: mapboxgl.FitBoundsOptions): void;
|
||||
fitBounds(bound: Bounds, fitBoundsOptions?: unknown): void;
|
||||
setZoomAndCenter(zoom: number, center: Point): void;
|
||||
setCenter(center: [number, number]): void;
|
||||
setPitch(pitch: number): void;
|
||||
|
|
|
@ -654,7 +654,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|||
/**
|
||||
* zoom to layer Bounds
|
||||
*/
|
||||
public fitBounds(fitBoundsOptions?: mapboxgl.FitBoundsOptions): ILayer {
|
||||
public fitBounds(fitBoundsOptions?: unknown): ILayer {
|
||||
if (!this.inited) {
|
||||
this.updateLayerConfig({
|
||||
autoFit: true,
|
||||
|
|
|
@ -157,11 +157,8 @@ export default class MapboxService
|
|||
this.panTo(pixel);
|
||||
}
|
||||
|
||||
public fitBounds(
|
||||
bound: Bounds,
|
||||
fitBoundsOptions?: mapboxgl.FitBoundsOptions,
|
||||
): void {
|
||||
this.map.fitBounds(bound, fitBoundsOptions);
|
||||
public fitBounds(bound: Bounds, fitBoundsOptions?: unknown): void {
|
||||
this.map.fitBounds(bound, fitBoundsOptions as mapboxgl.FitBoundsOptions);
|
||||
}
|
||||
|
||||
public setMaxZoom(max: number): void {
|
||||
|
|
|
@ -49,7 +49,7 @@ export default interface IMapController {
|
|||
/**
|
||||
* 调整地图适合指定区域
|
||||
*/
|
||||
fitBounds(bound: Bounds, fitBoundsOptions?: mapboxgl.FitBoundsOptions): void;
|
||||
fitBounds(bound: Bounds, fitBoundsOptions?: unknown): void;
|
||||
|
||||
setRotation(rotation: number): void;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class Scene
|
|||
private fontService: IFontService;
|
||||
private interactionService: IInteractionService;
|
||||
private animate: boolean;
|
||||
private fitBoundsOptions: mapboxgl.FitBoundsOptions;
|
||||
private fitBoundsOptions: unknown;
|
||||
private container: Container;
|
||||
|
||||
public constructor(config: ISceneConfig) {
|
||||
|
@ -279,14 +279,14 @@ class Scene
|
|||
public setZoom(zoom: number): void {
|
||||
this.mapService.setZoom(zoom);
|
||||
}
|
||||
public fitBounds(
|
||||
bound: Bounds,
|
||||
fitBoundsOptions?: mapboxgl.FitBoundsOptions,
|
||||
): void {
|
||||
public fitBounds(bound: Bounds, fitBoundsOptions?: unknown): void {
|
||||
this.mapService.fitBounds(
|
||||
bound,
|
||||
// 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
|
||||
fitBoundsOptions || { ...this.fitBoundsOptions, animate: this.animate },
|
||||
fitBoundsOptions || {
|
||||
...(this.fitBoundsOptions as object),
|
||||
animate: this.animate,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue