On Wed, Mar 17, 2010 at 5:14 PM, Olivier THIERRY
<[email protected]> wrote:
> Hi,
>
> I have a vector layer with two SelectFeature controls : one is used
> for selection, the other is used to show a popup.
> It works well except for one case : if I select an element in the
> vector, then I move the mouse to this element, the
> "featurehighlighted" event is fired, but on mouse out the
> "featureunhighlighted" event is not fired !
This is expected, although it's not clear to me whether this the
wished behavior.
1. mouse click on the feature -> control 1 selects the feature
2. mouse over the feature -> control 2 highlights the feature ->
"featurehighlighted" triggers
3. mouse out of feature -> control 2 detects that another control
(control 1) had highlighted the feature before it highlighted it
itself, so it uses that control to highlight the feature the way it
was highlighted before it highlighted it itself ->
"featureunhighlighted" does not trigger
Do you (or others) think we should trigger "featureunhighlighted"
after the call to theOtherControl.highlight()?
See attached patch (untested).
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : [email protected]
http://www.camptocamp.com
diff --git lib/OpenLayers/Control/SelectFeature.js lib/OpenLayers/Control/SelectFeature.js
index 1d85523..4f7d2aa 100644
--- lib/OpenLayers/Control/SelectFeature.js
+++ lib/OpenLayers/Control/SelectFeature.js
@@ -407,6 +407,7 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
// we do nothing if we're not the last highlighter of the
// feature
if(feature._lastHighlighter == this.id) {
+ var unhighlight = true;
// if another select control had highlighted the feature before
// we did it ourself then we use that control to highlight the
// feature as it was before we highlighted it, else we just
@@ -418,9 +419,14 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
feature._prevHighlighter);
if(control) {
control.highlight(feature);
+ unhighlight = false;
}
- } else {
+ }
+ if(unhighlight) {
this.unhighlight(feature);
+ } else {
+ this.events.triggerEvent(
+ "featureunhighlighted", {feature : feature});
}
}
} else {
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users