Merge pull request #2981 from bartvde/circle-linedash

Use lineDash in ol.style.Circle's and ol.style.RegularShape's stroke (r=@fredj,@elemoine)
This commit is contained in:
Bart van den Eijnden
2014-11-29 12:19:14 +01:00
2 changed files with 20 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ goog.provide('ol.style.Circle');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('ol.color');
goog.require('ol.has');
goog.require('ol.render.canvas');
goog.require('ol.style.Fill');
goog.require('ol.style.Image');
@@ -197,7 +198,7 @@ ol.style.Circle.prototype.unlistenImageChange = goog.nullFunction;
*/
ol.style.Circle.prototype.render_ = function() {
var canvas = this.canvas_;
var strokeStyle, strokeWidth;
var strokeStyle, strokeWidth, lineDash;
if (goog.isNull(this.stroke_)) {
strokeWidth = 0;
@@ -229,6 +230,10 @@ ol.style.Circle.prototype.render_ = function() {
}
if (!goog.isNull(this.stroke_)) {
context.strokeStyle = strokeStyle;
lineDash = this.stroke_.getLineDash();
if (ol.has.CANVAS_LINE_DASH && !goog.isNull(lineDash)) {
context.setLineDash(lineDash);
}
context.lineWidth = strokeWidth;
context.stroke();
}
@@ -253,6 +258,10 @@ ol.style.Circle.prototype.render_ = function() {
context.fill();
if (!goog.isNull(this.stroke_)) {
context.strokeStyle = strokeStyle;
lineDash = this.stroke_.getLineDash();
if (ol.has.CANVAS_LINE_DASH && !goog.isNull(lineDash)) {
context.setLineDash(lineDash);
}
context.lineWidth = strokeWidth;
context.stroke();
}

View File

@@ -3,6 +3,7 @@ goog.provide('ol.style.RegularShape');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('ol.color');
goog.require('ol.has');
goog.require('ol.render.canvas');
goog.require('ol.style.Fill');
goog.require('ol.style.Image');
@@ -226,7 +227,7 @@ ol.style.RegularShape.prototype.unlistenImageChange = goog.nullFunction;
*/
ol.style.RegularShape.prototype.render_ = function() {
var canvas = this.canvas_;
var strokeStyle, strokeWidth;
var strokeStyle, strokeWidth, lineDash;
if (goog.isNull(this.stroke_)) {
strokeWidth = 0;
@@ -268,6 +269,10 @@ ol.style.RegularShape.prototype.render_ = function() {
}
if (!goog.isNull(this.stroke_)) {
context.strokeStyle = strokeStyle;
lineDash = this.stroke_.getLineDash();
if (ol.has.CANVAS_LINE_DASH && !goog.isNull(lineDash)) {
context.setLineDash(lineDash);
}
context.lineWidth = strokeWidth;
context.stroke();
}
@@ -301,6 +306,10 @@ ol.style.RegularShape.prototype.render_ = function() {
context.fill();
if (!goog.isNull(this.stroke_)) {
context.strokeStyle = strokeStyle;
lineDash = this.stroke_.getLineDash();
if (ol.has.CANVAS_LINE_DASH && !goog.isNull(lineDash)) {
context.setLineDash(lineDash);
}
context.lineWidth = strokeWidth;
context.stroke();
}