[OpenLayers-Users] Re: [OpenLayers-Dev] Modify Control and Select
Control with highlight strange behaviour
Eric Lemoine
eric.lemoine at camptocamp.com
Thu May 3 17:30:56 EDT 2012
On Thu, May 3, 2012 at 8:44 PM, Ignacio Talavera
<ignacio.talavera at gmail.com> wrote:
> Hi, I'm trying to edit Vector layers and I want to combine the
> ModifyFeature control with a SelectControl with highlight capabilities.
> So I modified the
> example http://dev.openlayers.org/releases/OpenLayers-2.11/examples/modify-feature.html to
> do so with this snippet
>
> var highlightCtrl = new OpenLayers.Control.SelectFeature(vectors, {
> hover: true,
> highlightOnly: true,
> renderIntent: "temporary"});
>
> map.addControl(highlightCtrl);
> highlightCtrl.activate();
>
> The problem is when the ModifyFeatureControl is active and I select a
> feature, if I move the mouse over another feature and then I go back to the
> first one it looses the "select style".
> How can I avoid such a behaviour?
This is a bug. The bug is related to the ModifyFeature control not
adding its internal SelectFeature control to the map. How to fix the
bug isn't obvious to me right now. As a workaround you can manually
add the SelectFeature control to the map. In the modify-feature.html
this would translate to:
for(var key in controls) {
map.addControl(controls[key]);
}
map.addControl(controls.modify.selectControl); // added line
PS: please don't cross post to users and dev.
--
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
More information about the Users
mailing list