From f9950ec389f27402cee0f3f22ae06603783bfe73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sun, 3 Feb 2008 17:20:39 +0000 Subject: [PATCH] This commit solves the following problem with the select feature control: if you create two select feature controls on the same vector layer, one with hover:false that handles geometry type A only, and the other with hover:true that handles geometry type B only, then if you click on a geometry of type A and moves out of that geometry, the second control will unselect it. r=tschaub (closes #1221) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5975 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Handler/Feature.js | 2 +- tests/manual/select-feature.html | 150 ++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 tests/manual/select-feature.html diff --git a/lib/OpenLayers/Handler/Feature.js b/lib/OpenLayers/Handler/Feature.js index fba3d969c7..e9af869c16 100644 --- a/lib/OpenLayers/Handler/Feature.js +++ b/lib/OpenLayers/Handler/Feature.js @@ -211,6 +211,7 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, { // in feature for the first time this.triggerCallback(type, 'in', [this.feature]); } + this.lastFeature = this.feature; stopEvtPropag = true; } else { // not in to a feature @@ -219,7 +220,6 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, { this.triggerCallback(type, 'out', [this.lastFeature]); } } - this.lastFeature = this.feature; } else { if(previouslyIn || (click && this.lastFeature)) { this.triggerCallback(type, 'out', [this.lastFeature]); diff --git a/tests/manual/select-feature.html b/tests/manual/select-feature.html new file mode 100644 index 0000000000..303ed19466 --- /dev/null +++ b/tests/manual/select-feature.html @@ -0,0 +1,150 @@ + + + Select Feature Test + + + + + + +

Select Feature Test

+
+

+ + The map includes two select feature controls. The first one operates on + geometries of type OpenLayers.Geometry.Point only and works on clicks. The + second one operates on geometries of type OpenLayers.Geometry.Polygon and + works on mouseover's. If you select the point geometry by clicking on it, + it shouldn't be unselected when the mouse moves out if it. + +

+ + + + + Select Feature Test + + + + + + +

Select Feature Test

+
+

+ + The map includes two select feature controls. The first one operates on + geometries of type OpenLayers.Geometry.Point only and works on clicks. The + second one operates on geometries of type OpenLayers.Geometry.Polygon and + works on mouseover's. If you select the point geometry by clicking on it, + it shouldn't be unselected when the mouse moves out if it. + +

+ +