[OpenLayers-Users] Dragging and Selecting
Ivan Grcic
igrcic at gmail.com
Fri Nov 27 02:05:54 EST 2009
On Thu, Nov 26, 2009 at 8:44 PM, Mehmet Sirin <m.sirin07 at googlemail.com> wrote:
> 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 ?
Yes,but you have to make two selectfeature controls, one with
http://dev.openlayers.org/docs/files/OpenLayers/Control/SelectFeature-js.html#OpenLayers.Control.SelectFeature.highlightOnly
and one normal for click
> 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.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
Ivan Grcic
More information about the Users
mailing list