问题
I am using agm-circle in agm-map in angular 4. It works fine but the problem is that it move so fast when i dragged it. How to slow it down. Here is my code
<agm-map id="map" [latitude]="lat" [longitude]="lng">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
<agm-circle
[latitude]="lat" [longitude]="lng"
[circleDraggable]="true"
[editable]="true"
[fillColor]="circleColor"
(radiusChange)="radiusChange($event)"
(centerChange)="centerChange($event)"
[radius]="locationRadius"
>
</agm-circle>
</agm-map>
回答1:
The problem is with centerChange event which makes it fast. You can get your desire result by adding agm-marker event dragEnd to get lat and lng and make markerDraggable true to drag marker. Here is example code you can use.
<agm-map
id="map"
[latitude]="lat"
[longitude]="lng"
[zoom]="zoom"
[disableDefaultUI]="false"
[zoomControl]="false"
>
<agm-marker [latitude]="lat"
[markerDraggable] = "true"
(dragEnd) = "centerChange($event)"
[longitude]="lng"></agm-marker>
<agm-circle
[latitude]="lat" [longitude]="lng"
[circleDraggable]="true"
[editable]="true"
[fillColor]="circleColor"
(radiusChange)="radiusChange($event)"
[radius]="locationRadius"
(dragEnd)="centerChange($event)"
>
</agm-circle>
</agm-map>
Here is the reference link you can find out more details.
Reference Link
来源:https://stackoverflow.com/questions/54038801/agm-circle-angular-4-drag-sensitivity-so-fast