Leaflet.DistortableImage icon indicating copy to clipboard operation
Leaflet.DistortableImage copied to clipboard

cleaning up functions and let keywords

Open meggiddy opened this issue 3 years ago • 3 comments

Please describe the desired behavior. https://github.com/publiclab/Leaflet.DistortableImage/blob/main/src/DistortableCollection.js As seen in the code, a few "let" keywords are not reassigned and should be const. The function syntax can also be transformed into arrow functions.

@TildaDares, @jywarren Kindly advise if it's a desirable outcome.

meggiddy avatar Oct 13 '22 09:10 meggiddy

Hi @meggiddy, can you specify what lines need to be updated? Thank you!

TildaDares avatar Oct 13 '22 11:10 TildaDares

Hi @TildaDares

LET TO CONST Line 198 - 201: this.eachLayer(function(layer) { if (this.isCollected(layer)) { let sections = layer._image.src.split('/'); let filename = sections[sections.length-1]; let zc = layer.getCorners(); let corners = [ {lat: zc[0].lat, lon: zc[0].lng}, {lat: zc[1].lat, lon: zc[1].lng}, {lat: zc[3].lat, lon: zc[3].lng}, {lat: zc[2].lat, lon: zc[2].lng}, ]; The function syntax is just to Update the method creation syntax to ES6.

meggiddy avatar Oct 13 '22 12:10 meggiddy

Hi @meggiddy, I’ve looked through the file and I think all of the variables are declared with the appropriate variables. All of the methods are also created with the right syntax. We can leave the callback functions as is since it’s not a primary part of the code.

Thank you!

TildaDares avatar Oct 13 '22 14:10 TildaDares