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:
@@ -51,7 +51,9 @@
|
|||||||
stroke: true,
|
stroke: true,
|
||||||
fill: false,
|
fill: false,
|
||||||
label: "Point without fill",
|
label: "Point without fill",
|
||||||
labelAlign: "rb"
|
labelAlign: "rb",
|
||||||
|
fontColor: "#ff0000",
|
||||||
|
fontOpacity: 0.4
|
||||||
},
|
},
|
||||||
filter: new OpenLayers.Filter.Comparison({
|
filter: new OpenLayers.Filter.Comparison({
|
||||||
type: "==",
|
type: "==",
|
||||||
|
|||||||
@@ -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.
|
* labelSelect - {Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.
|
||||||
* Default is false.
|
* Default is false.
|
||||||
* fontColor - {String} The font color for the label, to be provided like CSS.
|
* 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.
|
* 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.
|
* 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.
|
* fontWeight - {String} The font weight for the label, to be provided like in CSS.
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
|
|||||||
|
|
||||||
this.setCanvasStyle("reset");
|
this.setCanvasStyle("reset");
|
||||||
this.canvas.fillStyle = style.fontColor;
|
this.canvas.fillStyle = style.fontColor;
|
||||||
this.canvas.globalAlpha = 1;
|
this.canvas.globalAlpha = style.fontOpacity || 1.0;
|
||||||
var fontStyle = style.fontWeight + " " + style.fontSize + " " + style.fontFamily;
|
var fontStyle = style.fontWeight + " " + style.fontSize + " " + style.fontFamily;
|
||||||
if (this.canvas.fillText) {
|
if (this.canvas.fillText) {
|
||||||
// HTML5
|
// HTML5
|
||||||
|
|||||||
@@ -702,6 +702,9 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
if (style.fontColor) {
|
if (style.fontColor) {
|
||||||
label.setAttributeNS(null, "fill", style.fontColor);
|
label.setAttributeNS(null, "fill", style.fontColor);
|
||||||
}
|
}
|
||||||
|
if (style.fontOpacity) {
|
||||||
|
label.setAttributeNS(null, "opacity", style.fontOpacity);
|
||||||
|
}
|
||||||
if (style.fontFamily) {
|
if (style.fontFamily) {
|
||||||
label.setAttributeNS(null, "font-family", style.fontFamily);
|
label.setAttributeNS(null, "font-family", style.fontFamily);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -810,6 +810,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
if (style.fillColor) {
|
if (style.fillColor) {
|
||||||
textbox.style.color = style.fontColor;
|
textbox.style.color = style.fontColor;
|
||||||
}
|
}
|
||||||
|
if (style.fontOpacity) {
|
||||||
|
textbox.style.filter = 'alpha(opacity=' + (style.fontOpacity * 100) + ')';
|
||||||
|
}
|
||||||
if (style.fontFamily) {
|
if (style.fontFamily) {
|
||||||
textbox.style.fontFamily = style.fontFamily;
|
textbox.style.fontFamily = style.fontFamily;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user