In OpenLayers, I have a Vector layer with a StyleMap
and SelectFeature
and ModifyFeature
controls, like this:
vector_layer = new OpenLayers.Layer.Vector('My Vector Layer', {extractAttributes: true,
styleMap: new OpenLayers.StyleMap({'default':{
strokeColor: "${customColor}",
strokeOpacity: 1,
strokeWidth: 2,
fillColor: "${customColor}",
fillOpacity: 0.5
}}) });
map.addLayer(vector_layer);
selectControl = new OpenLayers.Control.SelectFeature(vector_layer,
{onSelect: onFeatureSelect, onUnselect: onFeatureUnselect});
map.addControl(selectControl);
selectControl.activate();
modify_control = new OpenLayers.Control.ModifyFeature(vector_layer);
map.addControl(modify_control);
When I tick a checkbox on the page, the ModifyFeature control is activated:
modify_control.activate();
modify_control.mode |= OpenLayers.Control.ModifyFeature.ROTATE;
modify_control.mode |= OpenLayers.Control.ModifyFeature.DRAG;
The problem is this: when I remove the StyleMap
, ModifyFeature
shows the handles to drag and rotate the feature. With the StyleMap
, they are not visible.
Any suggestions how to fix this?