2.11 sketchstarted - new event?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

2.11 sketchstarted - new event?

rgreenwood
Earlier this week there was discussion about the 2.11 change in
behavior of the of the sketchstarted event.

http://osgeo-org.1560.n6.nabble.com/2-11-SketchStarted-td4550864.html

Some of us were relying on that event to detect when the first vertex
was added to a path or polygon. Eric Lemoine suggested a workaround
that is okay with callbacks, but not so good with LAYER.events.on().

How about a new event 'firstvertexadded' that does what sketchstarted
did before 2.11?

Thanks,
Rich

--
Richard Greenwood
[hidden email]
www.greenwoodmap.com
_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
Reply | Threaded
Open this post in threaded view
|

Re: 2.11 sketchstarted - new event?

erilem
On Thu, Mar 8, 2012 at 6:00 PM, Richard Greenwood
<[hidden email]> wrote:

> Earlier this week there was discussion about the 2.11 change in
> behavior of the of the sketchstarted event.
>
> http://osgeo-org.1560.n6.nabble.com/2-11-SketchStarted-td4550864.html
>
> Some of us were relying on that event to detect when the first vertex
> was added to a path or polygon. Eric Lemoine suggested a workaround
> that is okay with callbacks, but not so good with LAYER.events.on().
>
> How about a new event 'firstvertexadded' that does what sketchstarted
> did before 2.11?


If someone can do a pull request introducing a sketchcreated event
type as I described it in the previous thread, I can review it and
merge it into master (or 2.12 branch). The patch would basically
involve (a) replacing the current sketchstarted event by
sketchcreated, and (b) triggering sketchstarted when the first vertex
is added (and (c) adding tests, and making sure they pass in multiple
browsers!).

Thanks.


--
Eric Lemoine

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

Tel : 00 33 4 79 44 44 96
Mail : [hidden email]
http://www.camptocamp.com
_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
Reply | Threaded
Open this post in threaded view
|

Re: 2.11 sketchstarted - new event?

rgreenwood
On Thu, Mar 8, 2012 at 10:15 AM, Eric Lemoine
<[hidden email]> wrote:

> On Thu, Mar 8, 2012 at 6:00 PM, Richard Greenwood
> <[hidden email]> wrote:
>> Earlier this week there was discussion about the 2.11 change in
>> behavior of the of the sketchstarted event.
>>
>> http://osgeo-org.1560.n6.nabble.com/2-11-SketchStarted-td4550864.html
>>
>> Some of us were relying on that event to detect when the first vertex
>> was added to a path or polygon. Eric Lemoine suggested a workaround
>> that is okay with callbacks, but not so good with LAYER.events.on().
>>
>> How about a new event 'firstvertexadded' that does what sketchstarted
>> did before 2.11?
>
>
> If someone can do a pull request introducing a sketchcreated event
> type as I described it in the previous thread, I can review it and
> merge it into master (or 2.12 branch). The patch would basically
> involve (a) replacing the current sketchstarted event by
> sketchcreated, and (b) triggering sketchstarted when the first vertex
> is added (and (c) adding tests, and making sure they pass in multiple
> browsers!).
>
> Thanks.
>
>
> --
> Eric Lemoine

Eric,

1. Your suggested approach:

callbacks: {
        point: function(point, line) {
            if (line.components.length == 2) {
                // user has actually started to draw,
                // and "point" is the first draw point
            }
        }
    }

Would need to be modified for polygons something like:
   polygon.components[0].components.length == 3
and that still doesn't account for multi-polygon objects.

2. I tried to implement your method in an event handler registered to
a vector layer. I used the 'sketchmodified' event as follows:
if (event.type == 'sketchmodified' &&
event.feature.geometry.components[0].components.length == 3 )
but this continues to evaluate true until the next vertex is created.

Best regards,
Rich

--
Richard Greenwood
[hidden email]
www.greenwoodmap.com
_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
Reply | Threaded
Open this post in threaded view
|

Re: 2.11 sketchstarted - new event?

Xavier Mamano (jorix)
In reply to this post by erilem
Hi,

See https://github.com/openlayers/openlayers/pull/314 + https://github.com/openlayers/openlayers/pull/315

Details:
 * The "DrawFeature" control does not trigger "sketchstarted" event when using a "Handler.Point".
 * It may be interesting to distinguish between "sketchmodified" before "sketchstarted" and after (not Implemented)

Tests run on: IE8 IE9 Chrome17 FF10 and Safari5

Xavier Mamano

erilem wrote
On Thu, Mar 8, 2012 at 6:00 PM, Richard Greenwood
<[hidden email]> wrote:
> Earlier this week there was discussion about the 2.11 change in
> behavior of the of the sketchstarted event.
>
> http://osgeo-org.1560.n6.nabble.com/2-11-SketchStarted-td4550864.html
>
> Some of us were relying on that event to detect when the first vertex
> was added to a path or polygon. Eric Lemoine suggested a workaround
> that is okay with callbacks, but not so good with LAYER.events.on().
>
> How about a new event 'firstvertexadded' that does what sketchstarted
> did before 2.11?


If someone can do a pull request introducing a sketchcreated event
type as I described it in the previous thread, I can review it and
merge it into master (or 2.12 branch). The patch would basically
involve (a) replacing the current sketchstarted event by
sketchcreated, and (b) triggering sketchstarted when the first vertex
is added (and (c) adding tests, and making sure they pass in multiple
browsers!).

Thanks.


--
Eric Lemoine

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

Tel : 00 33 4 79 44 44 96
Mail : [hidden email]
http://www.camptocamp.com
_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
Reply | Threaded
Open this post in threaded view
|

Re: 2.11 sketchstarted - new event?

rgreenwood
Xavier -

Thank you very much for your work on this! I have not tested your
patches yet, but I wanted to say thank you right away. It looks very
much like I had in mind. I am not seeking any new functionality, I am
just hoping to see < 2.11 functionality restored. I also like what you
are doing with the "drawing" property, if I understand it correctly.

I have my app working under 2.11 by using a layer event handler for
sketchcomplete and callbacks for sketchstarted (sketchcreated). But
this seems a very ugly solution.

Again - thank you!
Rich

On Sun, Mar 11, 2012 at 4:09 PM, Xavier Mamano (jorix)
<[hidden email]> wrote:

> Hi,
>
> See https://github.com/openlayers/openlayers/pull/314 +
> https://github.com/openlayers/openlayers/pull/315
>
> Details:
>  * The "DrawFeature" control does not trigger "sketchstarted" event when
> using a "Handler.Point".
>  * It may be interesting to distinguish between "sketchmodified" before
> "sketchstarted" and after (not Implemented)
>
> Tests run on: IE8 IE9 Chrome17 FF10 and Safari5
>
> Xavier Mamano
>
>
> erilem wrote
>>
>> On Thu, Mar 8, 2012 at 6:00 PM, Richard Greenwood
>> &lt;richard.greenwood@&gt; wrote:
>>> Earlier this week there was discussion about the 2.11 change in
>>> behavior of the of the sketchstarted event.
>>>
>>> http://osgeo-org.1560.n6.nabble.com/2-11-SketchStarted-td4550864.html
>>>
>>> Some of us were relying on that event to detect when the first vertex
>>> was added to a path or polygon. Eric Lemoine suggested a workaround
>>> that is okay with callbacks, but not so good with LAYER.events.on().
>>>
>>> How about a new event 'firstvertexadded' that does what sketchstarted
>>> did before 2.11?
>>
>>
>> If someone can do a pull request introducing a sketchcreated event
>> type as I described it in the previous thread, I can review it and
>> merge it into master (or 2.12 branch). The patch would basically
>> involve (a) replacing the current sketchstarted event by
>> sketchcreated, and (b) triggering sketchstarted when the first vertex
>> is added (and (c) adding tests, and making sure they pass in multiple
>> browsers!).
>>
>> Thanks.
>>
>>
>> --
>> 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@
>> http://www.camptocamp.com
>> _______________________________________________
>> Dev mailing list
>> Dev@.osgeo
>> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/2-11-sketchstarted-new-event-tp4559041p4568364.html
> Sent from the OpenLayers Dev mailing list archive at Nabble.com.
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev



--
Richard Greenwood
[hidden email]
www.greenwoodmap.com
_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev