角度贴图的ZoomChange或centerChange事件?

问题描述 投票:0回答:1

你好我现在正在为一个我们使用Angular Maps的项目工作,前面使用Angular 6,后面使用Python。

我需要的是从API带来一定范围公里的有绳点。我已经有了编写的代码,我只需要能够实时检测变焦和坐标中心的变化吗?

我可以从文件map.js(自己的Angular Maps库文件)中检测到这些更改,但我无法从此文件更改主要组件的值。

有没有办法能够检测缩放和中心变化?

我正在寻找的功能非常类似于:

(mapClick) = "MyFunction1($event)" 

但是这样:

(zoomChange)="MyFunction2()"
angular typescript google-maps maps zoom
1个回答
0
投票

您可以解决问题,同样保留解决方案,以防有人需要它。

第1步:在你的文件.html添加

<agm-map [zoom]="mapa_cfg.zoom" [latitude]="mapa_cfg.latitud" [longitude]="mapa_cfg.longitud"(zoomChange)="zoomChange($event)" (centerChange)="centerChange($event)">

第2步:在你的文件.ts添加

zoomChange(event){
    console.log(event);
}

centerChange(event){
    console.log(event);
}
© www.soinside.com 2019 - 2024. All rights reserved.