publiclab / Leaflet.DistortableImage

A Leaflet extension to distort or "rubber sheet" images
https://publiclab.github.io/Leaflet.DistortableImage/examples/
BSD 2-Clause "Simplified" License
265 stars 284 forks source link

Change downloaded JSON to have "collection" key instead of "images" #1349

Open jywarren opened 1 year ago

jywarren commented 1 year ago

https://github.com/publiclab/Leaflet.DistortableImage/blob/8922aeb3c777da64506cd339b12d51ba772e67f5/examples/js/archive.js#L295

// download JSON
saveMap.addEventListener('click', () => {
  const jsonImages = {
    collection: map.imgGroup.generateExportJson(true).images
  }
jywarren commented 1 year ago

This will be compatible with changes in #1345, for a full download/upload lifecycle!

jywarren commented 1 year ago

The changes would also occur in this function:

https://github.com/publiclab/Leaflet.DistortableImage/blob/8cca752ca55b4aaa5ccedcb2689589e0f2eab1ff/dist/leaflet.distortableimage.js#L503-L541

segun-codes commented 1 year ago

https://github.com/publiclab/Leaflet.DistortableImage/blob/8922aeb3c777da64506cd339b12d51ba772e67f5/examples/js/archive.js#L295

// download JSON
saveMap.addEventListener('click', () => {
  const jsonImages = {
    collection: map.imgGroup.generateExportJson(true).images
  }

The changes suggested here have been implemented through PR #1345. Key changed from "images" to "collection."

segun-codes commented 1 year ago

The changes would also occur in this function:

https://github.com/publiclab/Leaflet.DistortableImage/blob/8cca752ca55b4aaa5ccedcb2689589e0f2eab1ff/dist/leaflet.distortableimage.js#L503-L541

Hi @jywarren, my understanding is that we agreed not to alter this code but repackage the return json into a format where key images is changed to "collection" within /example/archive.js. For this purpose, I had created such adapter in archive.js (see #1345) without altering the generateExportJson() in this light. Or is there a change of plan now?

jywarren commented 1 year ago

No, that's fine, that's what we decided for that PR! This issue is for if we decide later to completely rework things. I just think that if we do, it should be done separately from the purpose of the PR, and we shouldn't try to do them both together.

jywarren commented 1 year ago

This is also completed then, i think! isn't that right @segun-codes?