git-svn-id: http://svn.openlayers.org/branches/openlayers/2.9@10175 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2010-04-08 06:23:01 +00:00
parent 2150a2c783
commit bada3d98a1
3 changed files with 41 additions and 12 deletions
+30
View File
@@ -263,7 +263,10 @@ OpenLayers.Layer.Google = OpenLayers.Class(
*/ */
setVisibility: function(visible) { setVisibility: function(visible) {
this.setGMapVisibility(visible); this.setGMapVisibility(visible);
// sharing a map container, opacity has to be set per layer
var opacity = this.opacity == null ? 1 : this.opacity;
OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this, arguments); OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this, arguments);
this.setOpacity(opacity);
}, },
/** /**
@@ -303,6 +306,33 @@ OpenLayers.Layer.Google = OpenLayers.Class(
} }
}, },
/**
* APIMethod: setOpacity
* Sets the opacity for the entire layer (all images)
*
* Parameter:
* opacity - {Float}
*/
setOpacity: function(opacity) {
if (opacity !== this.opacity) {
if (this.map != null) {
this.map.events.triggerEvent("changelayer", {
layer: this,
property: "opacity"
});
}
this.opacity = opacity;
}
// Though this layer's opacity may not change, we're sharing a container
// and need to update the opacity for the entire container.
if (this.getVisibility()) {
var container = this.mapObject.getContainer();
OpenLayers.Util.modifyDOMElement(
container, null, null, null, null, null, null, opacity
);
}
},
/** /**
* APIMethod: destroy * APIMethod: destroy
* Clean up this layer. * Clean up this layer.
+8 -9
View File
@@ -424,9 +424,9 @@ OpenLayers.Map = OpenLayers.Class({
* ways to call the map constructor. See the examples below. * ways to call the map constructor. See the examples below.
* *
* Parameters: * Parameters:
* div - {String} Id of an element in your page that will contain the map. * div - {DOMElement|String} The element or id of an element in your page
* May be omitted if the <div> option is provided or if you intend * that will contain the map. May be omitted if the <div> option is
* to use <render> later. * provided or if you intend to call the <render> method later.
* options - {Object} Optional object with properties to tag onto the map. * options - {Object} Optional object with properties to tag onto the map.
* *
* Examples (method one): * Examples (method one):
@@ -595,12 +595,11 @@ OpenLayers.Map = OpenLayers.Class({
// add any initial layers // add any initial layers
if (options && options.layers) { if (options && options.layers) {
this.addLayers(options.layers); this.addLayers(options.layers);
} // set center (and optionally zoom)
if (options.center) {
// set center (and optionally zoom) // zoom can be undefined here
if (options && options.center) { this.setCenter(options.center, options.zoom);
// zoom can be undefined here }
this.setCenter(options.center, options.zoom);
} }
}, },
+2 -2
View File
@@ -848,9 +848,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
var align = style.labelAlign || "cm"; var align = style.labelAlign || "cm";
var xshift = textbox.clientWidth * var xshift = textbox.clientWidth *
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]); (OpenLayers.Renderer.VML.LABEL_SHIFT[align[0] || "c"]);
var yshift = textbox.clientHeight * var yshift = textbox.clientHeight *
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]); (OpenLayers.Renderer.VML.LABEL_SHIFT[align[1] || "m"]);
label.style.left = parseInt(label.style.left)-xshift-1+"px"; label.style.left = parseInt(label.style.left)-xshift-1+"px";
label.style.top = parseInt(label.style.top)+yshift+"px"; label.style.top = parseInt(label.style.top)+yshift+"px";