Ionic MARKER_DRAG_END 事件不工作
Ionic MARKER_DRAG_END event not working
当标记在地图中停止拖动时,我需要打印拖动
我添加了一个GoogleMapEvent.MARKERS_END它没有被触发
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);
});
当标记在地图中停止拖动时,我需要打印拖动
我添加了一个GoogleMapEvent.MARKERS_END它没有被触发
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);
});