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.
This commit is contained in:
Patrick Arlt 2015-07-02 13:35:23 -07:00
parent 1f21415240
commit caf692d2a8

View File

@ -8,6 +8,10 @@ L.ImageOverlay = L.Layer.extend({
opacity: 1, opacity: 1,
alt: '', alt: '',
interactive: false interactive: false
/*
crossOrigin: <Boolean>,
*/
}, },
initialize: function (url, bounds, options) { // (String, LatLngBounds, Object) initialize: function (url, bounds, options) { // (String, LatLngBounds, Object)
@ -114,6 +118,11 @@ L.ImageOverlay = L.Layer.extend({
img.onmousemove = L.Util.falseFn; img.onmousemove = L.Util.falseFn;
img.onload = L.bind(this.fire, this, 'load'); img.onload = L.bind(this.fire, this, 'load');
if (this.options.crossOrigin) {
img.crossOrigin = '';
}
img.src = this._url; img.src = this._url;
img.alt = this.options.alt; img.alt = this.options.alt;
}, },