离子MARKER_DRAG_END事件不工作
问题描述:
我需要在拖动标记停在地图离子MARKER_DRAG_END事件不工作
我加了一个GoogleMapEvent.MARKERS_END它没有得到triggerd
this.map.addMarker({
title: 'Current Location',
icon: 'red',
animation: 'DROP',
position: {
lat: this.location.lat,
lng: this.location.lng,
},
draggable: true,
})
.then((marker) => {
marker.on(GoogleMapsEvent.MARKER_DRAG_END)
.subscribe(() => {
console.log('dragged');
});
marker.on(GoogleMapsEvent.MARKER_CLICK)
.subscribe(() => {
alert('clicked');
});
});
答
这是解决何时打印拖累使用
this.map = this.googleMaps.create(this.mapElement, mapOptions);
创建地图
答
this.map.on(GoogleMapsEvent.MAP_DRAG).subscribe(
() => {
let pos = this.map.getCameraTarget();
this.marker.setPosition(pos);
});