Allow CanvasPattern or CanvasGradient as stroke style

This commit is contained in:
Frederic Junod
2016-09-06 08:57:04 +02:00
parent 51776ed79e
commit e48fda6bef
12 changed files with 97 additions and 34 deletions

View File

@@ -477,8 +477,8 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
case ol.render.canvas.Instruction.SET_STROKE_STYLE:
ol.DEBUG && console.assert(typeof instruction[1] === 'string',
'2nd instruction should be a string');
ol.DEBUG && console.assert(ol.colorlike.isColorLike(instruction[1]),
'2nd instruction should be a string, CanvasPattern, or CanvasGradient');
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
'3rd instruction should be a number');
ol.DEBUG && console.assert(typeof instruction[3] === 'string',
@@ -496,7 +496,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
context.stroke();
pendingStroke = 0;
}
context.strokeStyle = /** @type {string} */ (instruction[1]);
context.strokeStyle = /** @type {ol.ColorLike} */ (instruction[1]);
context.lineWidth = usePixelRatio ? lineWidth * pixelRatio : lineWidth;
context.lineCap = /** @type {string} */ (instruction[3]);
context.lineJoin = /** @type {string} */ (instruction[4]);