[OpenLayers-Users] How to recenter the map when drawing

Richard Greenwood richard.greenwood at gmail.com
Fri Feb 26 20:19:32 EST 2010


Steve,

This is not exactly what you are looking for, but you could watch
sketchmodified and when the mouse was within a few pixels of any edge
of the current map, you would pan the map a few pixels in that
direction. This would mimic the behavior of MapInfo's "edge panning"
(and probably other software) and it would provide the opportunity for
the user to pan beyond the current map extents to place a new vertex.
And you don't have to detect a 'click' or 'vertex added' event, which
apparently doesn't exist.

Regards,
Rich

On Fri, Feb 19, 2010 at 4:58 AM, smartini <nabble at stevemartin.org.uk> wrote:
>
>
> Christopher Schmidt-2 wrote:
>>
>> On Tue, Feb 16, 2010 at 08:56:24AM -0800, smartini wrote:
>>>
>>> Christopher,
>>> sketchmodified appears to fire constantly while you are drawing and the
>>> mouse is moving. I hooked this in to setCenter() for a laugh as the map
>>> constantly recentered as I moved the mouse. This event appears to offer a
>>> little more than I require.
>>>
>>> I console logged all the events just to see if there was anything
>>> suitable
>>> but alas, there was not, hence my cry for help.
>>
>> Makes sense. A quick look at the code doesn't show anything obvious that
>> would be better.
>>
>> -- Chris
>>
>
> So, would you or anybody else in the community have any suggestions as to
> how to go about handling such an event?
> I offer as an example a site which manages to accomplish this:
> http://www.sanoodi.com/routes/create/   (after registering/logging in)
> though I have as yet been unable to reverse engineer the approach used here.
>
> Regards,
> Steve
>
> --
> View this message in context: http://n2.nabble.com/How-to-recenter-the-map-when-drawing-tp4581070p4597434.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the Users mailing list