Basic support for canvas only (patch from trac #3503)

This commit is contained in:
Antoine Abt
2012-01-04 10:59:51 +01:00
parent 485ec033e9
commit 6be48e9ef9
2 changed files with 12 additions and 1 deletions
+10 -1
View File
@@ -527,7 +527,9 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
drawText: function(location, style) {
style = OpenLayers.Util.extend({
fontColor: "#000000",
labelAlign: "cm"
labelAlign: "cm",
labelOutlineColor: "white",
labelOutlineWidth: 3
}, style);
var pt = this.getLocalXY(location);
@@ -560,6 +562,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));
this.canvas.restore();
}
this.canvas.fillText(labelRows[i], pt[0], pt[1] + (lineHeight*i));
}
} else if (this.canvas.mozDrawText) {