0

onMapDrop

asked 2010-06-04 16:54:15 +0800

yuanbohan gravatar image yuanbohan
258 2 7

updated 2010-06-05 15:03:55 +0800

Can anyone tell me how can I get the marker drag event? I use the onMapDrop or onMarkerDrop event, but neither work well. The following are the codes:

map.addEventListener("onMapDrop", new EventListener(){
@Override
public void onEvent(Event event) throws Exception {
MapDropEvent mapDropEvent = (MapDropEvent)event;
double lat = mapDropEvent.getLat();
double lng = mapDropEvent.getLng();
map.panTo(lat, lng);
System.out.println("onMapDrop");// no print
}
});

but the onMapClick event works well.
map.addEventListener("onMapClick", new EventListener(){
@Override
public void onEvent(Event event) throws Exception {
MapMouseEvent mapMouseEvent = (MapMouseEvent)event;
Gmarker clickMarker = mapMouseEvent.getGmarker();
if(clickMarker != null){
clickMarker.setOpen(true);
}
}
});

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-06-06 20:19:32 +0800

samchuang gravatar image samchuang
4084 4

updated 2010-06-06 20:23:31 +0800

Hi

you could refer to zk demo, it use on move event, looks at it's source code

link publish delete flag offensive edit

answered 2010-06-08 04:58:21 +0800

yuanbohan gravatar image yuanbohan
258 2 7

hi samchuang,

thanks for your answer. I have tried another way to make it done. I fire the onMarkerDrop event to the marker but the map, then it works. ^_^

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-06-04 16:54:15 +0800

Seen: 520 times

Last updated: Jun 08 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More