diff --git a/.eslintrc.json b/.eslintrc.json index bf40dfa1..e0b14e79 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,6 +17,7 @@ "rules": { "arrow-body-style": ["warn", "as-needed"], "no-empty": "off", + "no-undef": "off", "@typescript-eslint/no-empty-function": "off", "@typescript-eslint/prefer-for-of": "warn", "no-var": "warn", diff --git a/js/locationfilter.js b/js/locationfilter.js index d79bcd98..eed444e6 100644 --- a/js/locationfilter.js +++ b/js/locationfilter.js @@ -13,11 +13,10 @@ * Version: 0.1 */ L.LatLngBounds.prototype.modify = function (map, amount) { - let sw = this.getSouthWest(), - ne = this.getNorthEast(), - swPoint = map.latLngToLayerPoint(sw), + const swPoint = map.latLngToLayerPoint(sw), nePoint = map.latLngToLayerPoint(ne); - + let sw = this.getSouthWest(), + ne = this.getNorthEast(); sw = map.layerPointToLatLng( new L.Point(swPoint.x - amount, swPoint.y + amount) ); @@ -108,7 +107,7 @@ L.LocationFilter = L.Control.extend({ anchor: [-10, -10], size: [13, 13] }); - this._moveMarker.on("drag", function (e) { + this._moveMarker.on("drag", (e) => { const markerPos = that._moveMarker.getLatLng(), latDelta = markerPos.lat - that._nw.lat, lngDelta = markerPos.lng - that._nw.lng; @@ -152,7 +151,7 @@ L.LocationFilter = L.Control.extend({ marker. Update filter corners and redraw the filter */ _setupResizeMarkerTracking: function (marker, options) { const that = this; - marker.on("drag", function (e) { + marker.on("drag", (e) => { const curPosition = marker.getLatLng(), latMarker = options.moveAlong.lat, lngMarker = options.moveAlong.lng; @@ -170,7 +169,7 @@ L.LocationFilter = L.Control.extend({ that._swMarker.getLatLng(), that._seMarker.getLatLng() ]; - corners.sort(function (a, b) { + corners.sort((a, b) => { if (a.lat != b.lat) return b.lat - a.lat; else return a.lng - b.lng; }); @@ -188,7 +187,7 @@ L.LocationFilter = L.Control.extend({ given marker */ _setupDragendListener: function (marker) { const that = this; - marker.on("dragend", function (e) { + marker.on("dragend", (e) => { // that.fire("change", {bounds: that.getBounds()}); }); },