now we can specify opacity on createAlphaImageDiv(). added tests. updated usage.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1544 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-10-03 18:38:40 +00:00
parent 8fe89ba734
commit 10e7761a97
3 changed files with 10 additions and 6 deletions

View File

@@ -95,6 +95,7 @@ OpenLayers.Tile.Image.prototype =
"absolute",
null,
null,
null,
true);
} else {
this.imgDiv = OpenLayers.Util.createImage(null,

View File

@@ -223,7 +223,8 @@ OpenLayers.Util.modifyAlphaImageDiv = function(div, id, px, sz, imgURL,
* @type DOMElement
*/
OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
position, border, sizing, delayDisplay) {
position, border, sizing,
opacity, delayDisplay) {
var div = OpenLayers.Util.createDiv();
var img = OpenLayers.Util.createImage(null, null, null, null, null, null,
@@ -238,8 +239,8 @@ OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
OpenLayers.Util.onImageLoadError.bindAsEventListener(div));
}
OpenLayers.Util.modifyAlphaImageDiv(div, id, px, sz, imgURL,
position, border, sizing);
OpenLayers.Util.modifyAlphaImageDiv(div, id, px, sz, imgURL, position,
border, sizing, opacity);
return div;
};

View File

@@ -178,7 +178,7 @@
}
function test_08_Util_createAlphaImageDiv(t) {
t.plan( 17 );
t.plan( 18 );
var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
var sz = new OpenLayers.Size(10,10);
@@ -187,8 +187,9 @@
var id = "boo";
var border = "1px solid";
var sizing = "crop";
var opacity = 0.5;
var imageDiv = OpenLayers.Util.createAlphaImageDiv(id, xy, sz, img, position, border, sizing);
var imageDiv = OpenLayers.Util.createAlphaImageDiv(id, xy, sz, img, position, border, sizing, opacity);
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
@@ -203,6 +204,7 @@
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
t.eq( imageDiv.style.position, position, "image.style.positionset correctly");
t.eq( imageDiv.style.opacity, opacity + "", "image.style.opacity set correctly");
image = imageDiv.firstChild;
@@ -307,7 +309,7 @@
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
t.eq( imageDiv.style.position, position, "image.style.position set correctly");
t.eq( imageDiv.style.opacity, opacity, "image.style.opacity set correctly");
t.eq( imageDiv.style.opacity, opacity + "", "image.style.opacity set correctly");
image = imageDiv.firstChild;