Public Lab

Make collection export option dynamic

Problem

If you run an export here with two images: https://sasha.mapknitter.org/examples/select.html, and then cancel it by clicking on the icon (just to save time), and then run a new export on only 1 image, you'll find that it still says exporting 2 / 2 images.

Since we call https://github.com/publiclab/Leaflet.DistortableImage/blob/449ec1506fb3c1a3cb624be52be8c7ade6538216/src/edit/DistortableCollection.Edit.js#L320

and save it back into the opts object, the next time it wont recall it and will keep re-using the same group of images.

quickest solution would be to just update the line to:

 opts.collection = this._group.generateExportJson();

but then custom collections wouldn't be possible anymore.

Waiting to call the function until inside the method would also work, but there seems to be issues with the this binding so would have to fix that

Task tags

  • javascript
  • hard
  • leaflet.distortableimage

Students who completed this task

VladeDev

Task type

  • code Code
close

2019