added a labelOutlineOpacity attribute to SVG and Canvas Renderers.
This commit is contained in:
@@ -422,7 +422,8 @@ 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.
|
||||||
* labelOutlineColor - {String} The color of the label outline. Default is 'white'. Only supported by the canvas & SVG renderers.
|
* labelOutlineColor - {String} The color of the label outline. Default is 'white'. Only supported by the canvas & SVG renderers.
|
||||||
* labelOutlineWidth - {Number} The width of the label outline. Default is 3, set to 0 or null to disable. Only supported by the canvas & SVG renderers.
|
* labelOutlineWidth - {Number} The width of the label outline. Default is 3, set to 0 or null to disable. Only supported by the SVG renderers.
|
||||||
|
* labelOutlineOpacity - {Number} The opacity (0-1) of the label outline. Default is fontOpacity. Only supported by the canvas & SVG renderers.
|
||||||
* 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
|
* 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.
|
||||||
|
|||||||
@@ -712,6 +712,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
|
|||||||
for (var i = 0; i < numRows; i++) {
|
for (var i = 0; i < numRows; i++) {
|
||||||
if (style.labelOutlineWidth) {
|
if (style.labelOutlineWidth) {
|
||||||
this.canvas.save();
|
this.canvas.save();
|
||||||
|
this.canvas.globalAlpha = style.labelOutlineOpacity || style.fontOpacity || 1.0;
|
||||||
this.canvas.strokeStyle = style.labelOutlineColor;
|
this.canvas.strokeStyle = style.labelOutlineColor;
|
||||||
this.canvas.lineWidth = style.labelOutlineWidth;
|
this.canvas.lineWidth = style.labelOutlineWidth;
|
||||||
this.canvas.strokeText(labelRows[i], pt[0], pt[1] + (lineHeight*i) + 1);
|
this.canvas.strokeText(labelRows[i], pt[0], pt[1] + (lineHeight*i) + 1);
|
||||||
|
|||||||
@@ -655,6 +655,9 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
outlineStyle.fontColor = outlineStyle.labelOutlineColor;
|
outlineStyle.fontColor = outlineStyle.labelOutlineColor;
|
||||||
outlineStyle.fontStrokeColor = outlineStyle.labelOutlineColor;
|
outlineStyle.fontStrokeColor = outlineStyle.labelOutlineColor;
|
||||||
outlineStyle.fontStrokeWidth = style.labelOutlineWidth;
|
outlineStyle.fontStrokeWidth = style.labelOutlineWidth;
|
||||||
|
if (style.labelOutlineOpacity) {
|
||||||
|
outlineStyle.fontOpacity = style.labelOutlineOpacity;
|
||||||
|
}
|
||||||
delete outlineStyle.labelOutlineWidth;
|
delete outlineStyle.labelOutlineWidth;
|
||||||
this.drawText(featureId, outlineStyle, location);
|
this.drawText(featureId, outlineStyle, location);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user