New fontOpacity option for vector feature style. r=pgiraud (closes #2438)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9978 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Frédéric Junod
2010-01-27 15:31:53 +00:00
parent 86eb16a208
commit 153cba8147
5 changed files with 11 additions and 2 deletions

View File

@@ -51,7 +51,9 @@
stroke: true,
fill: false,
label: "Point without fill",
labelAlign: "rb"
labelAlign: "rb",
fontColor: "#ff0000",
fontOpacity: 0.4
},
filter: new OpenLayers.Filter.Comparison({
type: "==",

View File

@@ -362,6 +362,7 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
* labelSelect - {Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.
* Default is false.
* fontColor - {String} The font color for the label, to be provided like CSS.
* fontOpacity - {Number} Opacity (0-1) for the label
* fontFamily - {String} The font family for the label, to be provided like in CSS.
* fontSize - {String} The font size for the label, to be provided like in CSS.
* fontWeight - {String} The font weight for the label, to be provided like in CSS.

View File

@@ -365,7 +365,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
this.setCanvasStyle("reset");
this.canvas.fillStyle = style.fontColor;
this.canvas.globalAlpha = 1;
this.canvas.globalAlpha = style.fontOpacity || 1.0;
var fontStyle = style.fontWeight + " " + style.fontSize + " " + style.fontFamily;
if (this.canvas.fillText) {
// HTML5

View File

@@ -702,6 +702,9 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
if (style.fontColor) {
label.setAttributeNS(null, "fill", style.fontColor);
}
if (style.fontOpacity) {
label.setAttributeNS(null, "opacity", style.fontOpacity);
}
if (style.fontFamily) {
label.setAttributeNS(null, "font-family", style.fontFamily);
}

View File

@@ -810,6 +810,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
if (style.fillColor) {
textbox.style.color = style.fontColor;
}
if (style.fontOpacity) {
textbox.style.filter = 'alpha(opacity=' + (style.fontOpacity * 100) + ')';
}
if (style.fontFamily) {
textbox.style.fontFamily = style.fontFamily;
}