diff --git a/dist/leaflet.distortableimage.js b/dist/leaflet.distortableimage.js index b546b443e..02e374e8a 100644 --- a/dist/leaflet.distortableimage.js +++ b/dist/leaflet.distortableimage.js @@ -3040,6 +3040,10 @@ L.DistortableCollection.Edit = L.Handler.extend({ }, cancelExport: function() { + if (!this.customCollection) { + this._exportOpts.collection = undefined; + } + clearInterval(this.updateInterval); }, @@ -3116,6 +3120,11 @@ L.DistortableCollection.Edit = L.Handler.extend({ if (data.status === 'complete') { clearInterval(self.updateInterval); + + if (!self.customCollection) { + self._exportOpts.collection = undefined; + } + resolve(); if (data.jpg !== null) { alert('Export succeeded. ' + opts.exportUrl + data.jpg); @@ -3150,7 +3159,7 @@ L.DistortableCollection.Edit = L.Handler.extend({ crossDomain: true, type: 'POST', data: { - collection: JSON.stringify(opts.collection.images), + collection: JSON.stringify(opts.collection), scale: opts.scale, upload: true, }, @@ -3158,7 +3167,14 @@ L.DistortableCollection.Edit = L.Handler.extend({ }); } - opts.collection = opts.collection || this._group.generateExportJson(); + // If the user has passed collection property + if (opts.collection) { + self.customCollection = true; + } else { + self.customCollection = false; + opts.collection = this._group.generateExportJson().images; + } + opts.frequency = opts.frequency || 3000; opts.scale = opts.scale || 100; // switch it to _getAvgCmPerPixel ! opts.updater = opts.updater || _defaultUpdater; diff --git a/package-lock.json b/package-lock.json index 645a5d930..0370290e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "leaflet-distortableimage", - "version": "0.11.1", + "version": "0.11.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f211c61d2..a39202ea5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "leaflet-distortableimage", - "version": "0.11.1", + "version": "0.11.2", "description": "Leaflet plugin enabling image overlays to be distorted, stretched, and warped (built for Public Lab's MapKnitter: http://publiclab.org).", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", diff --git a/src/edit/DistortableCollection.Edit.js b/src/edit/DistortableCollection.Edit.js index f346245ff..18917155e 100644 --- a/src/edit/DistortableCollection.Edit.js +++ b/src/edit/DistortableCollection.Edit.js @@ -199,6 +199,10 @@ L.DistortableCollection.Edit = L.Handler.extend({ }, cancelExport: function() { + if (!this.customCollection) { + this._exportOpts.collection = undefined; + } + clearInterval(this.updateInterval); }, @@ -275,6 +279,11 @@ L.DistortableCollection.Edit = L.Handler.extend({ if (data.status === 'complete') { clearInterval(self.updateInterval); + + if (!self.customCollection) { + self._exportOpts.collection = undefined; + } + resolve(); if (data.jpg !== null) { alert('Export succeeded. ' + opts.exportUrl + data.jpg); @@ -309,7 +318,7 @@ L.DistortableCollection.Edit = L.Handler.extend({ crossDomain: true, type: 'POST', data: { - collection: JSON.stringify(opts.collection.images), + collection: JSON.stringify(opts.collection), scale: opts.scale, upload: true, }, @@ -317,7 +326,14 @@ L.DistortableCollection.Edit = L.Handler.extend({ }); } - opts.collection = opts.collection || this._group.generateExportJson(); + // If the user has passed collection property + if (opts.collection) { + self.customCollection = true; + } else { + self.customCollection = false; + opts.collection = this._group.generateExportJson().images; + } + opts.frequency = opts.frequency || 3000; opts.scale = opts.scale || 100; // switch it to _getAvgCmPerPixel ! opts.updater = opts.updater || _defaultUpdater;