[OpenLayers-Users] combining drag and select layers on one map - drag not working

Ivan Grcic igrcic at gmail.com
Fri Dec 18 03:13:58 EST 2009


Hi,

    selectControl.handlers['feature'].stopDown = false;
    selectControl.handlers['feature'].stopUp = false;

is not working, right?

On Fri, Dec 18, 2009 at 1:57 AM, mehmet <m.sirin07 at googlemail.com> wrote:
>
> hi,
> I intend to do the same and experienced too that this is not possible.
> Is there really no solution to this issue? No one has an idea to solve this
> problem?
>
> I need to do this, because on layer1 i got some draggable marker and on
> layer2 wfs-features with pop-ups.
>
>
> regards
> m.sirin
>
>
> Eric Lemoine-2-2 wrote:
>>
>> Hi
>>
>> As you've noticed, since recently, you can have a select feature
>> control work with multiple vector layers. Yet, Andreas or others will
>> correct me if I'm wrong, your use case isn't covered - you cannot have
>> a drag control, working on one layer, and a select control working, on
>> another layer, activated at the same time. Only the layer(s) of the
>> control activated last will be interactive.
>>
>> Eric
>>
>> 2009/4/4, Charlie DeTar <chazen at gmail.com>:
>>> Hi,
>>>
>>> I'm trying to construct a map that contains a draggable marker in
>>> addition to features that, when clicked, produce a popup.  Reading the
>>> docs and examples, it seemed that the way to do this is to use a vector
>>> layer with a DragFeature control, and an additional vector layer with a
>>> SelectFeature control to handle popups.  However, I'm finding that once
>>> the SelectFeature control has been activated, the DragFeature no longer
>>> works -- dragging only pans the map.  I'm testing this using Firefox 3.0
>>> under Linux with stable OpenLayers (2.7).
>>>
>>> I've been trying to figure out if this has something to do with event
>>> propagation, and have tried setting stopUp and stopDown to false for
>>> both the dragFeature and selectFeature handlers to no effect.  Calling
>>> dragFeature.handlers.feature.moveLayerToTop() makes the drag handler
>>> work, but kills the selectFeature, regardless of what order the layers
>>> are added.  Though I would like both layers working simultaneously, I
>>> did find that disabling the selectable layer using the LayerSwitcher
>>> made the drag control work again in stable 2.7, but in the latest SVN
>>> R9190 dragging still doesn't work after disabling the selectable layer.
>>>
>>> Any suggestions for how I might be able to get a draggable layer and
>>> separate popup-producing layer working simultaneously on one map?
>>>
>>> Here are routines I'm using to construct the layers:
>>>
>>> var map;
>>> function init() {
>>>     map = new OpenLayers.Map('map');
>>>     map.addControl(new OpenLayers.Control.LayerSwitcher());
>>>     map.addLayer(
>>>        new OpenLayers.Layer.WMS("OpenLayers WMS",
>>>             "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} )
>>>     );
>>>
>>>     map.setCenter(new OpenLayers.Geometry.Point(0, 0), 4);
>>>
>>>     add_draggable();
>>>     add_selectable();
>>> }
>>> function add_draggable() {
>>>     var draggable = new OpenLayers.Layer.Vector(
>>>             "Draggable",
>>>             {
>>>                 styleMap: new OpenLayers.StyleMap({
>>>                     externalGraphic:
>>>                         "http://openlayers.org/dev/img/marker-gold.png",
>>>                     pointRadius: 10
>>>                 }),
>>>             }
>>>     );
>>>     map.addLayer(draggable)
>>>     draggable.addFeatures([
>>>         new OpenLayers.Feature.Vector(
>>>            new OpenLayers.Geometry.Point(0, 0)
>>>         )
>>>     ]);
>>>
>>>     var dragFeature = new OpenLayers.Control.DragFeature(draggable);
>>>     map.addControl(dragFeature);
>>>     dragFeature.activate();
>>> }
>>> function add_selectable() {
>>>     var selectable = new OpenLayers.Layer.Vector("Selectable");
>>>     selectable.addFeatures([
>>>         new OpenLayers.Feature.Vector(
>>>              new OpenLayers.Geometry.Point(5, 5)),
>>>         new OpenLayers.Feature.Vector(
>>>              new OpenLayers.Geometry.Point(-5, -5)),
>>>     ]);
>>>     map.addLayer(selectable);
>>>
>>>     var selectControl = new
>>>          OpenLayers.Control.SelectFeature(selectable);
>>>     map.addControl(selectControl);
>>>     selectControl.activate();
>>> }
>>>
>>> cheers,
>>> Charlie
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>
>>
>> --
>> Envoyé avec mon mobile
>>
>> 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 at camptocamp.com
>> http://www.camptocamp.com
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/combining-drag-and-select-layers-on-one-map-drag-not-working-tp2585226p4184443.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
>



-- 
Ivan Grcic



More information about the Users mailing list