Set opacity on layer div, not on tiles and markers. r=fredj (closes #3431)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12185 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -349,6 +349,11 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
this.div.style.width = "100%";
|
||||
this.div.style.height = "100%";
|
||||
this.div.dir = "ltr";
|
||||
if (this.opacity != null) {
|
||||
OpenLayers.Util.modifyDOMElement(
|
||||
this.div, null, null, null, null, null, null, this.opacity
|
||||
);
|
||||
}
|
||||
|
||||
this.events = new OpenLayers.Events(this, this.div,
|
||||
this.EVENT_TYPES);
|
||||
@@ -1269,11 +1274,8 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
setOpacity: function(opacity) {
|
||||
if (opacity != this.opacity) {
|
||||
this.opacity = opacity;
|
||||
for(var i=0, len=this.div.childNodes.length; i<len; ++i) {
|
||||
var element = this.div.childNodes[i].firstChild;
|
||||
OpenLayers.Util.modifyDOMElement(element, null, null, null,
|
||||
null, null, null, opacity);
|
||||
}
|
||||
OpenLayers.Util.modifyDOMElement(this.div, null, null, null,
|
||||
null, null, null, opacity);
|
||||
if (this.map != null) {
|
||||
this.map.events.triggerEvent("changelayer", {
|
||||
layer: this,
|
||||
|
||||
@@ -60,22 +60,6 @@ OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, {
|
||||
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setOpacity
|
||||
* Sets the opacity for all the markers.
|
||||
*
|
||||
* Parameter:
|
||||
* opacity - {Float}
|
||||
*/
|
||||
setOpacity: function(opacity) {
|
||||
if (opacity != this.opacity) {
|
||||
this.opacity = opacity;
|
||||
for (var i=0, len=this.markers.length; i<len; i++) {
|
||||
this.markers[i].setOpacity(this.opacity);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: moveTo
|
||||
*
|
||||
|
||||
@@ -590,21 +590,5 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
|
||||
return extent;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setOpacity
|
||||
* Call the setOpacity method of the appropriate parent class to set the
|
||||
* opacity.
|
||||
*
|
||||
* Parameter:
|
||||
* opacity - {Float}
|
||||
*/
|
||||
setOpacity: function (opacity) {
|
||||
if (this.vectorMode) {
|
||||
OpenLayers.Layer.Vector.prototype.setOpacity.apply(this, [opacity]);
|
||||
} else {
|
||||
OpenLayers.Layer.Markers.prototype.setOpacity.apply(this, [opacity]);
|
||||
}
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Layer.WFS"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user