Merge pull request #140 from aabt/outline
Add label outline to SVG and Canvas renderers
This commit is contained in:
@@ -525,10 +525,6 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
|
||||
* style - {Object}
|
||||
*/
|
||||
drawText: function(location, style) {
|
||||
style = OpenLayers.Util.extend({
|
||||
fontColor: "#000000",
|
||||
labelAlign: "cm"
|
||||
}, style);
|
||||
var pt = this.getLocalXY(location);
|
||||
|
||||
this.setCanvasStyle("reset");
|
||||
@@ -560,6 +556,13 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
|
||||
this.canvas.measureText('xx').width;
|
||||
pt[1] += lineHeight*vfactor*(numRows-1);
|
||||
for (var i = 0; i < numRows; i++) {
|
||||
if (style.labelOutlineWidth) {
|
||||
this.canvas.save();
|
||||
this.canvas.strokeStyle = style.labelOutlineColor;
|
||||
this.canvas.lineWidth = style.labelOutlineWidth;
|
||||
this.canvas.strokeText(labelRows[i], pt[0], pt[1] + (lineHeight*i) + 1);
|
||||
this.canvas.restore();
|
||||
}
|
||||
this.canvas.fillText(labelRows[i], pt[0], pt[1] + (lineHeight*i));
|
||||
}
|
||||
} else if (this.canvas.mozDrawText) {
|
||||
|
||||
Reference in New Issue
Block a user