From 10e7761a9745279ded93c74e55c00a11a9ac529c Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 3 Oct 2006 18:38:40 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Tile/Image.js | 1 + lib/OpenLayers/Util.js | 7 ++++--- tests/test_Util.html | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 8d4f88dc1d..167abf6cfe 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -95,6 +95,7 @@ OpenLayers.Tile.Image.prototype = "absolute", null, null, + null, true); } else { this.imgDiv = OpenLayers.Util.createImage(null, diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 608146bd22..59138b11bc 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -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; }; diff --git a/tests/test_Util.html b/tests/test_Util.html index d179a41c8c..252d6a90d4 100644 --- a/tests/test_Util.html +++ b/tests/test_Util.html @@ -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;