From: ricky c. <clo...@gm...> - 2009-10-09 22:32:35
|
hi there, I implemented something to get the moveend event from openlayers when the map has stopped moving (from drag etc), posting here for review/addition to code base if deemed fit. here's what i did: 1) add moveend to EventType: public static final String MAP_MOVE_END = "moveend"; 2) create a move end listener and event: public interface MapMoveEndListener extends EventListener { class MapMoveEndEvent extends MapEvent { public MapMoveEndEvent(EventObject eventObject) { super(eventObject.getJSObject()); } } void onMapMoveEnd(MapMoveEndEvent eventObject); } 3) then a method on map to allow addition of move end listener: public void addMapMoveEndListener(final MapMoveEndListener listener) { eventListeners.addListener(this, listener, EventType.MAP_MOVE_END, new EventHandler() { public void onHandle(EventObject eventObject) { MapMoveEndListener.MapMoveEndEvent e = new MapMoveEndListener.MapMoveEndEvent(eventObject); listener.onMapMoveEnd(e); } }); }; regards, Ricky |