replace useage of OpenLayers.Util.setOpacity() with OpenLayers.Util.modifyDOMElement(). Rewrite the former to use the latter, and mark the former as deprecated.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1551 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-10-03 19:38:15 +00:00
parent 7fa0910fcf
commit 25da469210
3 changed files with 11 additions and 4 deletions

View File

@@ -464,7 +464,8 @@ OpenLayers.Layer.prototype = {
this.opacity = opacity; this.opacity = opacity;
for(var i=0; i<this.div.childNodes.length; ++i) { for(var i=0; i<this.div.childNodes.length; ++i) {
var element = this.div.childNodes[i]; var element = this.div.childNodes[i];
OpenLayers.Util.setOpacity(element, opacity); OpenLayers.Util.modifyDOMElement(element, null, null, null,
null, null, null, opacity);
} }
}, },

View File

@@ -109,7 +109,10 @@ OpenLayers.Tile.Image.prototype =
} }
this.layer.div.appendChild(this.imgDiv); this.layer.div.appendChild(this.imgDiv);
if(this.layer.opacity != null) { if(this.layer.opacity != null) {
OpenLayers.Util.setOpacity(this.imgDiv, this.layer.opacity);
OpenLayers.Util.modifyDOMElement(this.imgDiv, null, null, null,
null, null, null,
this.layer.opacity);
} }
}, },

View File

@@ -134,6 +134,9 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
}; };
/** /**
* @deprecated -- Use OpenLayers.Util.modifyDOMElement() or
* OpenLayers.Util.modifyAlphaImageDiv()
*
* Set the opacity of a DOM Element * Set the opacity of a DOM Element
* Note that for this function to work in IE, elements must "have layout" * Note that for this function to work in IE, elements must "have layout"
* according to: * according to:
@@ -143,8 +146,8 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
* @param {Float} opacity Opacity value (0.0 - 1.0) * @param {Float} opacity Opacity value (0.0 - 1.0)
*/ */
OpenLayers.Util.setOpacity = function(element, opacity) { OpenLayers.Util.setOpacity = function(element, opacity) {
element.style.opacity = opacity; OpenLayers.Util.modifyDOMElement(element, null, null, null,
element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')'; null, null, null, opacity);
} }
OpenLayers.Util.onImageLoad = function() { OpenLayers.Util.onImageLoad = function() {