From caf692d2a8afff3ebf1633ec838cea37ade35247 Mon Sep 17 00:00:00 2001 From: Patrick Arlt Date: Thu, 2 Jul 2015 13:35:23 -0700 Subject: [PATCH] Allow for access to imageData on L.ImageOverlay This implements the changes in https://github.com/Leaflet/Leaflet/pull/2621 for cross origin tiles for `L.ImageOverlay` so that the image data can be accessed in canvas and saved. --- src/layer/ImageOverlay.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/layer/ImageOverlay.js b/src/layer/ImageOverlay.js index 48e23a21..8e46e7e7 100644 --- a/src/layer/ImageOverlay.js +++ b/src/layer/ImageOverlay.js @@ -8,6 +8,10 @@ L.ImageOverlay = L.Layer.extend({ opacity: 1, alt: '', interactive: false + + /* + crossOrigin: , + */ }, initialize: function (url, bounds, options) { // (String, LatLngBounds, Object) @@ -114,6 +118,11 @@ L.ImageOverlay = L.Layer.extend({ img.onmousemove = L.Util.falseFn; img.onload = L.bind(this.fire, this, 'load'); + + if (this.options.crossOrigin) { + img.crossOrigin = ''; + } + img.src = this._url; img.alt = this.options.alt; },