[OpenLayers-Users] Dragging and Selecting

Mehmet Sirin m.sirin07 at googlemail.com
Thu Nov 26 14:44:47 EST 2009


Hi,

somehow my combined select and drag does not work the way I want..
for the first time I click on "marker-green" it turns into "marker blue",
but after i clicked out and reselect the feature it won't turn to blue. But
then it's still draggable.. just the selectControl seems to be deactivated.

And my second question: Is it possible to use both hover and select ?
Because turning on hover turns off the normal selectFeature ability...


take a look at the code that is responsible for the above described problem:

            var vectors1 = new OpenLayers.Layer.Vector("Vector Layer 1", {
                styleMap: new OpenLayers.StyleMap({
                    "default": new
OpenLayers.Style(OpenLayers.Util.applyDefaults({
                        externalGraphic: "../img/marker-green.png",
                        graphicOpacity: 1,
                        rotation: -45,
                        pointRadius: 10
                    }, OpenLayers.Feature.Vector.style["default"])),
                    "select": new OpenLayers.Style({
                        externalGraphic: "../img/marker-blue.png"
                    })
                })
            });

            map.addLayers([wmsLayer, vectors1]);
            map.addControl(new OpenLayers.Control.LayerSwitcher());

            selectControl = new OpenLayers.Control.SelectFeature(
                [vectors1],
                {
                    clickout: true, toggle: false,
                    multiple: false, hover: false,
                    toggleKey: "ctrlKey",
                    multipleKey: "shiftKey"
                }
            );

            map.addControl(selectControl);

            map.setCenter(new OpenLayers.LonLat(0, 0), 3);
            vectors1.addFeatures(createFeatures());

          var dragFeature = new
OpenLayers.Control.DragFeature(vectors1,{});


            map.addControl(dragFeature);
            dragFeature.activate();
          selectControl.activate();



in hope someone could help me..
regards
mehmet sirin c.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091126/9e318e9b/attachment.html


More information about the Users mailing list