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:
@@ -95,6 +95,7 @@ OpenLayers.Tile.Image.prototype =
|
|||||||
"absolute",
|
"absolute",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
true);
|
true);
|
||||||
} else {
|
} else {
|
||||||
this.imgDiv = OpenLayers.Util.createImage(null,
|
this.imgDiv = OpenLayers.Util.createImage(null,
|
||||||
|
|||||||
@@ -223,7 +223,8 @@ OpenLayers.Util.modifyAlphaImageDiv = function(div, id, px, sz, imgURL,
|
|||||||
* @type DOMElement
|
* @type DOMElement
|
||||||
*/
|
*/
|
||||||
OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
|
OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
|
||||||
position, border, sizing, delayDisplay) {
|
position, border, sizing,
|
||||||
|
opacity, delayDisplay) {
|
||||||
|
|
||||||
var div = OpenLayers.Util.createDiv();
|
var div = OpenLayers.Util.createDiv();
|
||||||
var img = OpenLayers.Util.createImage(null, null, null, null, null, null,
|
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.onImageLoadError.bindAsEventListener(div));
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenLayers.Util.modifyAlphaImageDiv(div, id, px, sz, imgURL,
|
OpenLayers.Util.modifyAlphaImageDiv(div, id, px, sz, imgURL, position,
|
||||||
position, border, sizing);
|
border, sizing, opacity);
|
||||||
|
|
||||||
return div;
|
return div;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -178,7 +178,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_08_Util_createAlphaImageDiv(t) {
|
function test_08_Util_createAlphaImageDiv(t) {
|
||||||
t.plan( 17 );
|
t.plan( 18 );
|
||||||
|
|
||||||
var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
|
var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
|
||||||
var sz = new OpenLayers.Size(10,10);
|
var sz = new OpenLayers.Size(10,10);
|
||||||
@@ -187,8 +187,9 @@
|
|||||||
var id = "boo";
|
var id = "boo";
|
||||||
var border = "1px solid";
|
var border = "1px solid";
|
||||||
var sizing = "crop";
|
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)
|
if (!isMozilla)
|
||||||
t.ok( true, "skipping element test outside of Mozilla");
|
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.height, sz.h + "px", "image.style.height set correctly");
|
||||||
|
|
||||||
t.eq( imageDiv.style.position, position, "image.style.positionset 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;
|
image = imageDiv.firstChild;
|
||||||
@@ -307,7 +309,7 @@
|
|||||||
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
|
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.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;
|
image = imageDiv.firstChild;
|
||||||
|
|||||||
Reference in New Issue
Block a user