[OpenLayers-Users] Problem with SelectFeature control

Alexandre Dube adube at mapgears.com
Tue Mar 8 12:17:35 EST 2011


Hi,

   This has been fixed in trunk in the past few days.  I just tried with 
current trunk version and get the expected behavior.  See the according 
ticket :
http://trac.osgeo.org/openlayers/ticket/2812#comment:6

Regards,

Alexandre


On 11-03-08 11:50 AM, Bob Farrell wrote:
> Hi there,
>
> Having great success with OpenLayers but have found one minor issue
> which may be a bug but hopefully is just a mistake on my part.
>
> Firstly, here's my code (or here with highlighting if you prefer:
> http://bpaste.net/show/SjHd7xV7pZUnJNzYcI89/):
>
>          var highlightCtrl = new OpenLayers.Control.SelectFeature(layer, {
>              hover: true,
>              highlightOnly: true,
>              renderIntent: "temporary"
>          });
>
>          var selectControl = new OpenLayers.Control.SelectFeature(layer,
>              {
>               multiple: true,
>               toggle: true,
>               clickout: false,
>               onSelect: function (e) {
>                  that._selectedRegions[e.data.id] = true;
>                  that.changeCallback({id: e.data.id, selected: true},
>                                      that._selectedRegions);
>                  },
>               onUnselect: function (e) {
>                  that._selectedRegions[e.data.id] = false;
>                  that.changeCallback({id: e.data.id, selected: false},
>                                      that._selectedRegions);
>                  }
>              }
>          );
>          this._map.addControl(highlightCtrl);
>          this._map.addControl(selectControl);
>          highlightCtrl.activate();
>          selectControl.activate();
>
> The problem I'm seeing is that when I click a region to select it and
> then click again to deselect it, when I hover back over that region
> and then back out of it then its colour is restored to the "selected"
> colour, even though no onSelect event is triggered.
>
> Am I doing something wrong here ?
>
> Let me know if I can provide any more info.
>
> Thanks very much,
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list