From 665a8275f6f0421931a6a9f1bfbb84e1f02ccea8 Mon Sep 17 00:00:00 2001 From: philip Date: Fri, 3 Apr 2020 21:54:42 +0000 Subject: [PATCH] It appears that Safari and Chrome behave differently when doing a drawImage with coordinates that are outside the source. Chrome appears to draw the piece of the image that is within the area specified on the drawImage and within the source. Safari bails and draws nothing if (I think) any of the corners are outside the source. --- src/ol/reproj.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/ol/reproj.js b/src/ol/reproj.js index e0420e7a8c..7e286d0715 100644 --- a/src/ol/reproj.js +++ b/src/ol/reproj.js @@ -314,13 +314,7 @@ export function render(width, height, pixelRatio, context.scale(sourceResolution / pixelRatio, -sourceResolution / pixelRatio); - const sourceTriangleExtent = boundingExtent(source); - const topLeftX = Math.floor((sourceTriangleExtent[0] - sourceDataExtent[0]) * stitchScale); - const topLeftY = Math.floor((sourceDataExtent[3] - sourceTriangleExtent[3]) * stitchScale); - const width = Math.ceil((sourceTriangleExtent[2] - sourceTriangleExtent[0]) * stitchScale) + 2; - const height = Math.ceil((sourceTriangleExtent[3] - sourceTriangleExtent[1]) * stitchScale) + 2; - - context.drawImage(stitchContext.canvas, topLeftX, topLeftY, width, height, topLeftX, topLeftY, width, height); + context.drawImage(stitchContext.canvas, 0, 0); context.restore(); });