[OpenLayers-Users] How to implement draggable Markers?

KartoPete psingler at gmx.de
Wed Jan 7 11:05:27 EST 2009




Alan Boudreault wrote:
> 
> KartoPete wrote:
>> Hi guys, 
>> I#m working with OpenLayers2.6 and try make my markers draggable. I tried
>> a
>> few edited classes I found here but it wouldn't work out, even the posted
>> example(long time ago) wouldn't work on my machine. Does anyone know if
>> draggable markers is already working with the new or future versions? Or
>> has
>> someone a idea on how to implement this? 
>> thx Pete
>>   
> Something that you can do is to create a new class "DraggableMarker"
> that inherit of OpenLayers.Marker. This class will mainly handle 2
> events: mouseup and mousedown:
> 
>  this.events.register('mousedown', this, this._markerDown);
>  this.events.registerPriority('mouseup', this, this._markerUp);
> 
> Thanks, I'll try
> But why registerPriority()?
> 
> After that, the mousedown function will activate the event "mousemove"
> and the mouseup will disable it. And the mousemove handle will calculate
> the new position and move the marker on the fly.
> 
> Hope this help.
> Alan
> 
> 
> -- 
> Alan Boudreault
> Mapgears
> http://www.mapgears.com
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-implement-draggable-Markers--tp2122977p2123235.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list