agm-circle angular 4 drag sensitivity so fast

戏子无情 提交于 2020-07-22 08:32:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!