Allow ol.style.Stroke#width to be undefined

This commit is contained in:
Tom Payne
2013-11-14 00:05:18 +01:00
parent 6796b9735e
commit d60bc61a72
3 changed files with 3 additions and 3 deletions

View File

@@ -278,7 +278,7 @@ ol.render.canvas.Immediate.prototype.setFillStrokeStyle =
if (!ol.style.stroke.equals(state.strokeStyle, strokeStyle)) { if (!ol.style.stroke.equals(state.strokeStyle, strokeStyle)) {
if (goog.isDefAndNotNull(strokeStyle)) { if (goog.isDefAndNotNull(strokeStyle)) {
context.strokeStyle = ol.color.asString(strokeStyle.color); context.strokeStyle = ol.color.asString(strokeStyle.color);
context.lineWidth = strokeStyle.width; context.lineWidth = goog.isDef(strokeStyle.width) ? strokeStyle.width : 1;
} }
state.strokeStyle = strokeStyle; state.strokeStyle = strokeStyle;
} }

View File

@@ -145,7 +145,7 @@ ol.render.canvas.Replay.prototype.draw = function(context, transform) {
goog.asserts.assert(goog.isObject(instruction[1])); goog.asserts.assert(goog.isObject(instruction[1]));
var strokeStyle = /** @type {ol.style.Stroke} */ (instruction[1]); var strokeStyle = /** @type {ol.style.Stroke} */ (instruction[1]);
context.strokeStyle = ol.color.asString(strokeStyle.color); context.strokeStyle = ol.color.asString(strokeStyle.color);
context.lineWidth = strokeStyle.width; context.lineWidth = goog.isDef(strokeStyle.width) ? strokeStyle.width : 1;
++i; ++i;
} else if (type == ol.render.canvas.Instruction.STROKE) { } else if (type == ol.render.canvas.Instruction.STROKE) {
context.stroke(); context.stroke();

View File

@@ -37,7 +37,7 @@ ol.shape.renderCircle = function(radius, fillStyle, strokeStyle) {
} }
if (goog.isDefAndNotNull(strokeStyle)) { if (goog.isDefAndNotNull(strokeStyle)) {
context.strokeStyle = ol.color.asString(strokeStyle.color); context.strokeStyle = ol.color.asString(strokeStyle.color);
context.lineWidth = strokeStyle.width; context.lineWidth = goog.isDef(strokeStyle.width) ? strokeStyle.width : 1;
context.stroke(); context.stroke();
} }