[OpenLayers-Dev] Re: 2.11 SketchStarted

Eric Lemoine eric.lemoine at camptocamp.com
Tue Mar 6 08:47:18 EST 2012


On Tue, Mar 6, 2012 at 2:15 PM, fell_runner <stewartb at esdm.co.uk> wrote:
> Thanks for the reply, but I don't understand your answer.
>
> The vector layer has no features to start with.

When you move the mouse over the map there should a vector point following.

> The user activates the
> drawfeature control and I'm using the 'sketchstarted' event to determine the
> co-ordinates of where the user has started drawing.

You can try this (untested):

new OpenLayers.Control.Draw(layer, OpenLayers.Handler.Path, {
    callbacks: {
        point: function(point, line) {
            if (line.components.length == 2) {
                // user has actually started to draw,
                // and "point" is the first draw point
            }
        }
    }
});


-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Dev mailing list