mirror of https://gitee.com/antv-l7/antv-l7
feat: 添加animate配置项
This commit is contained in:
parent
7d46b5242d
commit
6dae6ca1a8
|
@ -8,6 +8,7 @@ export interface ISceneConfig extends IRenderConfig {
|
|||
map: IMapWrapper;
|
||||
logoPosition?: PositionName;
|
||||
logoVisible?: boolean;
|
||||
animate?: boolean;
|
||||
fitBoundsOptions?: mapboxgl.FitBoundsOptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ? (
|
||||
<LayerContext.Provider value={layer}>
|
||||
<Source layer={layer} source={source} />
|
||||
|
|
|
@ -58,6 +58,7 @@ class Scene
|
|||
private popupService: IPopupService;
|
||||
private fontService: IFontService;
|
||||
private interactionService: IInteractionService;
|
||||
private animate: boolean;
|
||||
private fitBoundsOptions: mapboxgl.FitBoundsOptions;
|
||||
private container: Container;
|
||||
|
||||
|
@ -67,7 +68,8 @@ class Scene
|
|||
map,
|
||||
logoPosition,
|
||||
logoVisible = true,
|
||||
fitBoundsOptions = { animate: true },
|
||||
animate = true,
|
||||
fitBoundsOptions = {},
|
||||
} = config;
|
||||
this.fitBoundsOptions = fitBoundsOptions;
|
||||
// 创建场景容器
|
||||
|
@ -281,7 +283,11 @@ class Scene
|
|||
bound: Bounds,
|
||||
fitBoundsOptions?: mapboxgl.FitBoundsOptions,
|
||||
): void {
|
||||
this.mapService.fitBounds(bound, this.fitBoundsOptions || fitBoundsOptions);
|
||||
this.mapService.fitBounds(
|
||||
bound,
|
||||
// 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
|
||||
fitBoundsOptions || { ...this.fitBoundsOptions, animate: this.animate },
|
||||
);
|
||||
}
|
||||
|
||||
public setZoomAndCenter(zoom: number, center: Point): void {
|
||||
|
|
Loading…
Reference in New Issue