I’m using gwt-maps-3.8.0, in that i want to use both clickhandler and dblclickhandler for the same marker. Its not working if we use both.. Pls refer my code below..
`VerticalPanel panel = new VerticalPanel();
GoogleMap mapWidget;
LatLng myLatLng = LatLng.create(13.774252, 80.190262);
MapOptions myOptions = MapOptions.create();
myOptions.setZoom(8.0);
myOptions.setCenter(myLatLng);
myOptions.setScaleControl(true);
myOptions.setMapTypeId(MapTypeId.ROADMAP);
mapWidget = GoogleMap.create(panel.getElement(), myOptions);
Marker marker = Marker.create();
marker.setMap(mapWidget);
marker.addDblClickListener(new DblClickHandler() {
@Override
public void handle(MouseEvent event) {
Window.alert("Double Click");
}
});
marker.addClickListener(new ClickHandler() {
@Override
public void handle(MouseEvent event) {
Window.alert("Single");
}
});`
It looks like the Click (single) handler would be fired. Is that what is happening?
I suspect that when a user double clicks, the first click triggers the click event before the second click is detected.
The only way I know around this is to effectively listen for a second click from within the ClickHandler. Here is a Java example (not GWT) that you might find useful: http://blogs.sophiacom.fr/flex/2008/08/double-click.html
Does anyone know of a cleaner way to do this?
Or by “Its not working if we use both” did you mean that the marker is not appearing?
If so, this is probably because you haven’t set the marker position: