mirror of https://gitee.com/antv-l7/antv-l7
feat: scene添加fitBoundsOptions属性
This commit is contained in:
parent
d66b541c7c
commit
7c427cc749
|
@ -8,6 +8,7 @@ export interface ISceneConfig extends IRenderConfig {
|
||||||
map: IMapWrapper;
|
map: IMapWrapper;
|
||||||
logoPosition?: PositionName;
|
logoPosition?: PositionName;
|
||||||
logoVisible?: boolean;
|
logoVisible?: boolean;
|
||||||
|
fitBoundsOptions?: mapboxgl.FitBoundsOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// interface IValidateResult {
|
// interface IValidateResult {
|
||||||
|
|
|
@ -58,11 +58,18 @@ class Scene
|
||||||
private popupService: IPopupService;
|
private popupService: IPopupService;
|
||||||
private fontService: IFontService;
|
private fontService: IFontService;
|
||||||
private interactionService: IInteractionService;
|
private interactionService: IInteractionService;
|
||||||
|
private fitBoundsOptions: mapboxgl.FitBoundsOptions;
|
||||||
private container: Container;
|
private container: Container;
|
||||||
|
|
||||||
public constructor(config: ISceneConfig) {
|
public constructor(config: ISceneConfig) {
|
||||||
const { id, map, logoPosition, logoVisible = true } = config;
|
const {
|
||||||
|
id,
|
||||||
|
map,
|
||||||
|
logoPosition,
|
||||||
|
logoVisible = true,
|
||||||
|
fitBoundsOptions = { animate: true },
|
||||||
|
} = config;
|
||||||
|
this.fitBoundsOptions = fitBoundsOptions;
|
||||||
// 创建场景容器
|
// 创建场景容器
|
||||||
const sceneContainer = createSceneContainer();
|
const sceneContainer = createSceneContainer();
|
||||||
this.container = sceneContainer;
|
this.container = sceneContainer;
|
||||||
|
@ -274,7 +281,7 @@ class Scene
|
||||||
bound: Bounds,
|
bound: Bounds,
|
||||||
fitBoundsOptions?: mapboxgl.FitBoundsOptions,
|
fitBoundsOptions?: mapboxgl.FitBoundsOptions,
|
||||||
): void {
|
): void {
|
||||||
this.mapService.fitBounds(bound, fitBoundsOptions);
|
this.mapService.fitBounds(bound, this.fitBoundsOptions || fitBoundsOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setZoomAndCenter(zoom: number, center: Point): void {
|
public setZoomAndCenter(zoom: number, center: Point): void {
|
||||||
|
|
Loading…
Reference in New Issue