Web Maps API: listen for dragend event on polyline changes?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Web Maps API: listen for dragend event on polyline changes?

Jordan Anderson
Hi all,

I've built some basic line snapping functionality using the polyline's
'lineupdated' event. I would much prefer to use something like a
'dragend' event as I just ignore most of the lineupdated events since
they fire on every pixel movement. It looks as if polylines with
editing enabled are firing a dragend event at some point. How would I
go about adding a listener to these events?

Thanks,
Jordan
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Web Maps API: listen for dragend event on polyline changes?

Vladimir Agafonkin
Hi Jordan,

The polyline has a _createMarker method which creates markers for the editing, you can probably redefine it to attach your dragend listener on it, like this:

var originalCreateMarker = CM.Polyline.prototype._createMarker;

CM.Polyline.prototype._createMarker = function() {
    var marker = originalCreateMarker.apply(this, arguments);
    // ... attach dragend on marker
    return marker;
};

On Thu, Sep 9, 2010 at 6:18 AM, Jordan Anderson <[hidden email]> wrote:
Hi all,

I've built some basic line snapping functionality using the polyline's
'lineupdated' event. I would much prefer to use something like a
'dragend' event as I just ignore most of the lineupdated events since
they fire on every pixel movement. It looks as if polylines with
editing enabled are firing a dragend event at some point. How would I
go about adding a listener to these events?

Thanks,
Jordan
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev



--
Vladimir Agafonkin
Front-End Architect, CloudMade
+380 93 745 44 61

_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Web Maps API: listen for dragend event on polyline changes?

Jordan Anderson
Worked perfectly - thanks!

On Fri, Sep 10, 2010 at 10:47 AM, Vladimir Agafonkin
<[hidden email]> wrote:

> Hi Jordan,
>
> The polyline has a _createMarker method which creates markers for the
> editing, you can probably redefine it to attach your dragend listener on it,
> like this:
>
> var originalCreateMarker = CM.Polyline.prototype._createMarker;
>
> CM.Polyline.prototype._createMarker = function() {
>     var marker = originalCreateMarker.apply(this, arguments);
>     // ... attach dragend on marker
>     return marker;
> };
>
> On Thu, Sep 9, 2010 at 6:18 AM, Jordan Anderson <[hidden email]>
> wrote:
>>
>> Hi all,
>>
>> I've built some basic line snapping functionality using the polyline's
>> 'lineupdated' event. I would much prefer to use something like a
>> 'dragend' event as I just ignore most of the lineupdated events since
>> they fire on every pixel movement. It looks as if polylines with
>> editing enabled are firing a dragend event at some point. How would I
>> go about adding a listener to these events?
>>
>> Thanks,
>> Jordan
>> _______________________________________________
>> Dev site list
>> [hidden email]
>> http://lists.cloudmade.com/listinfo/dev
>
>
>
> --
> Vladimir Agafonkin
> Front-End Architect, CloudMade
> +380 93 745 44 61
>
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev
Loading...