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

Tim Welch tim.j.welch at gmail.com
Tue Mar 23 22:42:17 EDT 2010


Always looking for different drawing implementations I took a look.  Notice
that as you draw a line in Sanoodi you don't get a line from the last drawn
vertice to your mouse pointer as it moves around (default OL control).  Also
each of your vertices have a circle.  So a Sanoodi 'line' actually looks
like a combination of a line feature with point features and as you click an
additional point it adds a new vertice to the line and redraws it on the
screen.  It might even just be drawing multiple line segments.  Probably
just using the map onclick event to trigger this.  In fact if you double
click just slow enough (two fast single clicks effectively) you can get it
to create a point without adding the next line segment.

-Tim

On Fri, Feb 26, 2010 at 6:19 PM, Richard Greenwood <
richard.greenwood at gmail.com> wrote:

> 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
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100323/2bbac214/attachment.html


More information about the Users mailing list