SelectFeature control - highlightOnly and toggle don't play well together, p=me, r=bartvde (closes #2812)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11633 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -463,8 +463,23 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
unhighlight: function(feature) {
|
||||
var layer = feature.layer;
|
||||
feature._lastHighlighter = feature._prevHighlighter;
|
||||
delete feature._prevHighlighter;
|
||||
// three cases:
|
||||
// 1. there's no other highlighter, in that case _prev is undefined,
|
||||
// and we just need to undef _last
|
||||
// 2. another control highlighted the feature after we did it, in
|
||||
// that case _last references this other control, and we just
|
||||
// need to undef _prev
|
||||
// 3. another control highlighted the feature before we did it, in
|
||||
// that case _prev references this other control, and we need to
|
||||
// set _last to _prev and undef _prev
|
||||
if(feature._prevHighlighter == undefined) {
|
||||
delete feature._lastHighlighter;
|
||||
} else if(feature._prevHighlighter == this.id) {
|
||||
delete feature._prevHighlighter;
|
||||
} else {
|
||||
feature._lastHighlighter = feature._prevHighlighter;
|
||||
delete feature._prevHighlighter;
|
||||
}
|
||||
layer.drawFeature(feature, feature.style || feature.layer.style ||
|
||||
"default");
|
||||
this.events.triggerEvent("featureunhighlighted", {feature : feature});
|
||||
|
||||
Reference in New Issue
Block a user