Make sure icons show up in Safari

Make sure that drawImage calls don't exceed source image dimensions.
This commit is contained in:
Bart van den Eijnden
2016-01-12 15:44:50 +01:00
parent 936cd6a028
commit 4ef1f5e63f
6 changed files with 115 additions and 17 deletions

View File

@@ -349,8 +349,11 @@ ol.render.canvas.Replay.prototype.replay_ = function(
context.globalAlpha = alpha * opacity;
}
context.drawImage(image, originX, originY, width, height,
x, y, width * pixelRatio, height * pixelRatio);
var w = (width + originX > image.width) ? image.width - originX : width;
var h = (height + originY > image.height) ? image.height - originY : height;
context.drawImage(image, originX, originY, w, h,
x, y, w * pixelRatio, h * pixelRatio);
if (opacity != 1) {
context.globalAlpha = alpha;