What I want is that you simply click the marker, hold the button down, drag
and drop.
Like this example:
http://code.google.com/apis/maps/documentation/javascript/v2/examples/marker-drag.html
(ignore the balloon in this example)

As I understand it, if I use the ModifyFeature control I'll have to click it
first (click and release) to select the marker. Then do my click/drag/drop.
As in this example:
http://openlayers.org/dev/examples/modify-feature.html

In the openlayers example above, draw a point, then tick "modify feature /
allow dragging". You have to click to select, then you're allowed to
drag/drop.

Bit fiddly to explain - hope that's clear!



On 1 October 2010 17:19, P Kishor <[email protected]> wrote:

> On Fri, Oct 1, 2010 at 11:10 AM, James Humphreys
> <[email protected]> wrote:
> > Hi Alexandre,
> > Thanks for your suggestion. It's a good idea, but not quite the effect
> I'd
> > like to achieve. If I understand correctly, the user would have to
> actually
> > select the feature first then drag? I'd like the drag to "just work"
> without
> > having to click it first.
>
>
> How can you drag something without first clicking and selecting? Your
> request is not clear. Care to elaborate?
>
> > Unfortunately, I don't have time to try out the code right now (on Sunday
> > maybe?) but if do figure out how to do this I'll make sure I post it up
> for
> > everyone.
> > Thanks,
> > James
> >
> > On 30 September 2010 13:18, Alexandre Dube <[email protected]> wrote:
> >>
> >> Hi James,
> >>
> >>   You could try to replace both the SelectFeature and DragFeature
> controls
> >> by a ModifyFeature control, which contains a SelectFeature control
> itself so
> >> you could listen to its "featureselected" event to display your popup.
> >> Dragging the marker while it's selected should work.
> >>
> >> Regards,
> >>
> >> Alexandre
> >>
> >>
> >> On 10-09-29 04:43 PM, James Humphreys wrote:
> >>
> >> Hi,
> >>
> >> I'd like to have markers on the map that have a baloon appear when I
> click
> >> them, and are also draggable. I've created an OpenLayers map with
> markers
> >> using a vector layer. When I click on the markers I'd like a baloon to
> pop
> >> up (a FramedCloud). That's easy enough - I added a SelectFeature control
> >> which, when clicked, add a FramedCloud to the map. Secondly, I'd like
> those
> >> markers to be draggable, so I added a DragFeature control to the vector
> >> layer.
> >> It look like those two Controls can't co-exist. If I add them both, the
> >> SelectFeature control doesn't work.
> >>
> >> I've put a quick example up at
> >> http://www.humphreys.be/james/selectanddrag/selectanddrag.html
> >> Here I've activated both features, so only "drag" works. You can
> download
> >> the selectanddrag.HTML and selectanddrag.JS file to your PC, modify and
> play
> >> with them. If you switch off the dragFeature, the selectControl works
> fine.
> >>
> >> I saw this has been discussed before, back in Feb:
> >>
> http://osgeo-org.1803224.n2.nabble.com/Click-on-OpenLayers-Feature-Vector-td4631284.html
> >> According to this post the two Controls simply aren't compatible.
> >>
> >> Has the situation changed? Does anyone know how I can create a marker
> that
> >> can have a bubble appear when I click it AND is draggable?
> >> I'd love to hear anyone's opinion on this before I delve head first into
> >> writing my own custom control (and I'm not that great at Javascript so
> it
> >> could take a while...)
> >>
> >> Thanks,
> >>
> >>
> >> James
> >>
> >>
> >> Here's a code snippet:
> >>
> >> map = new OpenLayers.Map('map');
> >>
> >> var layer = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
> >>     map.addLayer(layer);
> >>
> >> placesVL = new OpenLayers.Layer.Vector("My places", {... });
> >> map.addLayer(placesVL);
> >>
> >> var marker1 = new OpenLayers.Feature.Vector(getPoint(-0.58, 51.8));
> >> var marker2 = new OpenLayers.Feature.Vector(getPoint(-0.53, 51.2));
> >> placesVL.addFeatures([marker1, marker2]);
> >>
> >> selectControl = new OpenLayers.Control.SelectFeature(placesVL,
> >>                 {onSelect: onFeatureSelect, onUnselect:
> >> onFeatureUnselect});
> >> map.addControl(selectControl);
> >> selectControl.activate();
> >>
> >> var dragFeature = new OpenLayers.Control.DragFeature(placesVL,
> >> {'onComplete': onDragPlaceComplete});
> >> map.addControl(dragFeature);
> >> dragFeature.activate();
> >>
> >> _______________________________________________
> >> Users mailing list
> >> [email protected]
> >> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> >>
> >>
> >> --
> >> Alexandre Dubé
> >> Mapgears
> >> www.mapgears.com
> >>
> >> _______________________________________________
> >> Users mailing list
> >> [email protected]
> >> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> >>
> >
> >
> > _______________________________________________
> > Users mailing list
> > [email protected]
> > http://lists.osgeo.org/mailman/listinfo/openlayers-users
> >
> >
>
>
>
> --
> Puneet Kishor http://www.punkish.org
> Carbon Model http://carbonmodel.org
> Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
> Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
> Nelson Institute, UW-Madison http://www.nelson.wisc.edu
> -----------------------------------------------------------------------
> Assertions are politics; backing up assertions with evidence is science
> =======================================================================
>
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to