[OpenLayers-Users] Trouble adding ModifyFeature control to EditingPanel

Matti Hansson g8a at email.com
Wed Aug 11 09:57:56 EDT 2010


Hi!
I want an EditingPanel with an additional modify control in my map. 
After following the "Customizing an existing panel" example ( 
http://docs.openlayers.org/library/controls.html#customizing-an-existing-panel 
), I have this:

controls = [
      new OpenLayers.Control.DrawFeature(drawLayer,
          OpenLayers.Handler.Polygon, {
        displayClass: 'olControlDrawFeaturePolygon'
      }),
      new OpenLayers.Control.DrawFeature(drawLayer,
          OpenLayers.Handler.Path, {
        displayClass: 'olControlDrawFeaturePath'
      }),
      new OpenLayers.Control.DrawFeature(drawLayer,
          OpenLayers.Handler.Point, {
        displayClass: 'olControlDrawFeaturePoint'
      }),
      new OpenLayers.Control.ModifyFeature(drawLayer, {
         mode: OpenLayers.Control.ModifyFeature.RESHAPE | 
OpenLayers.Control.ModifyFeature.DRAG,
        displayClass: 'olControlModifyFeature'
      }),
      new OpenLayers.Control.Navigation(),
    ];

    var toolbar = new OpenLayers.Control.Panel({
      displayClass: 'olControlEditingToolbar'
    });
    toolbar.addControls(controls);
    map.addControl(toolbar);

and this css in the head of the page to see if it's working:

<script type="text/css">

  .olControlEditingToolbar .olControlModifyFeatureItemInactive {
    background-color: #ff0000;
    background-position: 5px 4px;
  }

  .olControlEditingToolbar .olControlModifyFeatureItemActive {
    background-color: #0000ff;
    background-position: -4px -5px;
  }

  </script>

Now, the modify control itself works like a charm and does exactly what 
it's supposed to, but the css styling has no effect and I'm left with a 
move_feature_off.png image, regardless of whether the control is active 
or not.

Can anyone point me in the right direction?
Thanks!
/Matti



More information about the Users mailing list