[OpenLayers-Users] How to implement draggable Markers?

KartoPete psingler at gmx.de
Thu Jan 8 10:47:43 EST 2009


good idea, 
I tried first version and can't stop the mousemove event. Any ideas? If it
would be my own code I would do it different, but I#m stuck in many code
from another author, who worked on the project before. My actuell
DraggableMarkerClass looks like this:
OpenLayers.Marker.DraggableMarker = OpenLayers.Class(OpenLayers.Marker, {
	
	layer: null,
	currentEvent: null,
	
	registerEvents: function(){
		this.events.registerPriority('mousedown', this, this.onMarkerDown);
		this.map.events.register('mouseup', this, this.onMarkerUp);
	},
	
	onMarkerDown: function(){
		this.map.events.register('mousemove', this, this.onMove);
	},
	onMarkerUp: function(){
		
		Event.stop(this.currentEvent);
		
	},
	onMove: function(e){
		 	var lonlat = this.map.getLonLatFromViewPortPx(e.xy);
		 	var marker = new OpenLayers.Marker.DraggableMarker(new
OpenLayers.LonLat(lonlat.lon,lonlat.lat), markerIcon2.clone());
		 	this.layer.clearMarkers();
		 	this.layer.addMarker(marker);
		 	this.currentEvent = e;
	},
	
	
    CLASS_NAME: "OpenLayers.Marker.DraggableMarker"
});

As I already said, I can't stop the mousemove-Event!
Any ideas?
thx,
Pete
-- 
View this message in context: http://n2.nabble.com/How-to-implement-draggable-Markers--tp2122977p2128501.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list