[OpenLayers-Trac] [OpenLayers] #3537: feature clickout might not be
triggered
OpenLayers
trac-20090302 at openlayers.org
Tue Oct 4 13:00:43 EDT 2011
#3537: feature clickout might not be triggered
---------------------+------------------------------------------------------
Reporter: anrikun | Owner:
Type: bug | Status: new
Priority: major | Milestone: 2.12 Release
Component: general | Version: 2.11
Keywords: | State:
---------------------+------------------------------------------------------
I had a problem with my Control.SelectFeature: sometimes onUnselect was
not called.
After debugging for hours, I think I've finally found the bug and a fix.
The problem is that in Handler/Feature.js, line 281, there is:
{{{
if(this.lastFeature && !this.lastFeature.layer) {
// last feature has been destroyed
this.lastFeature = null;
}
}}}
But in Control/SelectFeature.js, line 510, there is:
{{{
if(!this.handlers.feature.lastFeature) {
this.handlers.feature.lastFeature =
layer.selectedFeatures[0];
}
}}}
This means, that is the selected feature has been destroyed, Feature.js
clears lastFeature, but SelectFeature.js does not perform the same check!
To fix that, Control/SelectFeature.js, line 510 should be:
{{{
if(!this.handlers.feature.lastFeature ||
!this.handlers.feature.lastFeature.layer) {
this.handlers.feature.lastFeature =
layer.selectedFeatures[0];
}
}}}
--
Ticket URL: <http://trac.openlayers.org/ticket/3537>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list