SelectFeature and OpenLayers.Feature.Vector.style["select"]: changed Control.SelectFeature to inherit properties that are not set in selectStyle from feature.style. r=tschaub (closes #1260)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@5896 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -220,11 +220,23 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
select: function(feature) {
|
||||
// Store feature style for restoration later
|
||||
if(feature.originalStyle == null) {
|
||||
if(feature.originalStyle != feature.style) {
|
||||
feature.originalStyle = feature.style;
|
||||
}
|
||||
this.layer.selectedFeatures.push(feature);
|
||||
feature.style = this.selectStyle;
|
||||
|
||||
var selectStyle = this.selectStyle;
|
||||
|
||||
if (feature.style.CLASS_NAME == "OpenLayers.Style") {
|
||||
feature.style = feature.style.createStyle(feature);
|
||||
} else {
|
||||
feature.style = OpenLayers.Util.extend({}, feature.style);
|
||||
}
|
||||
if (selectStyle.CLASS_NAME == "OpenLayers.Style") {
|
||||
selectStyle = selectStyle.createStyle(feature);
|
||||
}
|
||||
OpenLayers.Util.extend(feature.style, selectStyle);
|
||||
|
||||
this.layer.drawFeature(feature);
|
||||
this.onSelect(feature);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user