Permalink
Browse files

Nicer caps and joins

As mentioned in the TODOs, caps and joins should be user configurable on the symbolizers.
  • Loading branch information...
1 parent b28a1ef commit db4e62477d64761ba6e9fe6118f86c054771d912 @tschaub tschaub committed Mar 7, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/ol/renderer/canvas/canvasrenderer.js
@@ -139,6 +139,8 @@ ol.renderer.canvas.Renderer.prototype.renderLineStringFeatures_ =
context.globalAlpha = symbolizer.opacity;
context.strokeStyle = symbolizer.strokeStyle;
context.lineWidth = symbolizer.strokeWidth * this.inverseScale_;
+ context.lineCap = 'round'; // TODO: accept this as a symbolizer property
+ context.lineJoin = 'round'; // TODO: accept this as a symbolizer property
context.beginPath();
for (i = 0, ii = features.length; i < ii; ++i) {
geometry = features[i].getGeometry();
@@ -240,6 +242,8 @@ ol.renderer.canvas.Renderer.prototype.renderPolygonFeatures_ =
if (strokeStyle) {
context.strokeStyle = symbolizer.strokeStyle;
context.lineWidth = symbolizer.strokeWidth * this.inverseScale_;
+ context.lineCap = 'round'; // TODO: accept this as a symbolizer property
+ context.lineJoin = 'round'; // TODO: accept this as a symbolizer property
}
if (fillStyle) {
context.fillStyle = fillStyle;
@@ -330,6 +334,8 @@ ol.renderer.canvas.Renderer.renderCircle_ = function(circle) {
if (strokeStyle) {
context.lineWidth = strokeWidth;
context.strokeStyle = strokeStyle;
+ context.lineCap = 'round'; // TODO: accept this as a symbolizer property
+ context.lineJoin = 'round'; // TODO: accept this as a symbolizer property
}
context.beginPath();

0 comments on commit db4e624

Please sign in to comment.