Reversing the order we set opacity changes the behavior when using VE, but

nothing else. This fixes the fact that you can't use client side opacity 
while including the Virtual Earth javascript. Thanks for the spot from
Jeff Yutzler. Includes a manual test. (Closes #1175)   


git-svn-id: http://svn.openlayers.org/trunk/openlayers@5326 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-12-02 20:46:15 +00:00
parent 70ec5ed6de
commit 92f5a7d749
2 changed files with 63 additions and 1 deletions

View File

@@ -171,8 +171,8 @@ OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
element.style.overflow = overflow;
}
if (opacity) {
element.style.opacity = opacity;
element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
element.style.opacity = opacity;
}
};

View File

@@ -0,0 +1,62 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 512px;
height: 512px;
border: 1px solid gray;
}
</style>
<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
// make map available for easy debugging
var map;
// avoid pink tiles
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
OpenLayers.Util.onImageLoadErrorColor = "transparent";
function init(){
var options = {
projection: "EPSG:900913",
units: "m",
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
20037508, 20037508.34)
};
map = new OpenLayers.Map('map', options);
// create Virtual Earth layers
var veroad = new OpenLayers.Layer.VirtualEarth(
"Virtual Earth Raods",
{'type': VEMapStyle.Road, 'sphericalMercator': true}
);
// create WMS layer
var wms = new OpenLayers.Layer.WMS(
"World Map",
"http://world.freemap.in/tiles/",
{'layers': 'factbook-overlay', 'format':'png'},
{
'opacity': 0.4,
'isBaseLayer': false,'wrapDateLine': true
}
);
map.addLayers([veroad, wms]);
map.zoomToMaxExtent()
}
</script>
</head>
<body onload="init()">
<h3>VE Opacity</h3>
<p>The overlay should have an opacity of 40%.</p>
<div id="map"></div>
</body>
</html>