[OpenLayers-Users] Dragging markers?
Erik Uzureau
euzuro at gmail.com
Tue Oct 24 12:07:44 EDT 2006
For the record, dragging markers *onto* the map would not be particularly
difficult.
Off the top of my head, the way you would go about this is:
- make a map, add a baselayer and a markers layer
- in your application code, you can create markers on your own and place
them
where you wish on your toolbar.
- You will then have to write your own little drag-n-drop handler to allow
the user
to click and drag a marker anywhere on the screen. (not *too* tough)
- You should be sure to set some sort of global (or tagged to your
OpenLayers.Map
object) flag that indicates that a marker is being dragged.
- You then register an "onmouseup" even on your OpenLayers.Map.events, and
in that function you:
- check to make sure the marker-dragging flag is set
- get the current mousepx
- translate that mousepx into lonlat
- add the marker to your markers layer at that given lonlat.
Note that I haven't *tried* the above code, but off the top of my head, I
don't see why
this shouldn't work.
If anyone wants to put together a demo that does this, it would be awesome.
Erik
On 10/10/06, Erik Uzureau <euzuro at gmail.com> wrote:
>
> Hi David,
>
> Currently, OpenLayers does not support dragging makers on or off the map,
> nor do we support ZK.
>
> If there is community interest, however, we should maybe look into either
> or
> both of these.... anyone?
>
> Erik
>
> On 10/6/06, David R Robison <drrobison at openroadsconsulting.com> wrote:
> > I am new to OpenLayers. What I want to do is to drag a marker to another
> > component on the page. I am using ZK and want to drag a marker
> > representing a camera to a DIV and then catch the drop and display the
> > snapshot corresponding to that marker. Is it possible to drag markers in
> > OpenLayers off the map and to another component?
> >
> > Thanks, David Robison
> >
> > --
> >
> > David R Robison
> > Open Roads Consulting, Inc.
> > 708 S. Battlefield Blvd., Chesapeake, VA 23322
> > phone: (757) 546-3401
> > e-mail: drrobison at openroadsconsulting.com
> > web: http://openroadsconsulting.com
> > blog: http://therobe.blogspot.com
> > book: http://www.xulonpress.com/bookstore/titles/1597816523.htm
> >
> >
> >
> >
> > _______________________________________________
> > 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/20061024/a07fccc2/attachment.html
More information about the Users
mailing list