nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 4ec8544bad03b8cf14fe91e1f601ffa34e64b7ce
parent 16b0c750c7e4609b1bab2e2b29e23609f090e0ef
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Sat, 25 Jan 2020 18:23:37 +0100

fix lint errors (max-len)

Diffstat:
Mscripts/build.js | 6+++++-
Msrc/layers.js | 38+++++++++++++++++++++++++++-----------
Msrc/lib/leaflet.control.coordinates/formats.js | 3++-
Msrc/lib/leaflet.control.coordinates/index.js | 3++-
Msrc/lib/leaflet.control.elevation-profile/index.js | 10++++++++--
Msrc/lib/leaflet.control.jnx/index.js | 2+-
Msrc/lib/leaflet.control.layers.adaptive-height/index.js | 3++-
Msrc/lib/leaflet.control.layers.configure/index.js | 21++++++++++++++++-----
Msrc/lib/leaflet.control.locate/index.js | 19++++++++++++-------
Msrc/lib/leaflet.control.panoramas/index.js | 3++-
Msrc/lib/leaflet.control.panoramas/lib/google/index.js | 2+-
Msrc/lib/leaflet.control.panoramas/lib/mapillary/index.js | 5+++--
Msrc/lib/leaflet.control.panoramas/lib/wikimedia/index.js | 12++++++++++--
Msrc/lib/leaflet.control.printPages/decoration.grid.js | 5++++-
Msrc/lib/leaflet.control.printPages/decoration.magnetic-meridians.js | 5++++-
Msrc/lib/leaflet.control.printPages/decoration.scale.js | 5++++-
Msrc/lib/leaflet.control.printPages/map-render.js | 11++++++++++-
Msrc/lib/leaflet.control.printPages/pageFeature.js | 3++-
Msrc/lib/leaflet.control.track-list/lib/geo_file_exporters.js | 16+++++++++++++---
Msrc/lib/leaflet.control.track-list/lib/services/gpsies.js | 3++-
Msrc/lib/leaflet.control.track-list/lib/services/gpslib.js | 3++-
Msrc/lib/leaflet.control.track-list/lib/services/osm.js | 3++-
Msrc/lib/leaflet.control.track-list/lib/services/sportstracker.js | 4+++-
Msrc/lib/leaflet.control.track-list/track-list.js | 17++++++++++++-----
Msrc/lib/leaflet.layer.bing/index.js | 5++++-
Msrc/lib/leaflet.layer.strava-heatmap/index.js | 12++++++++----
Msrc/lib/leaflet.layer.westraPasses/westraPassesMarkers.js | 11+++++++++--
Msrc/lib/leaflet.polyline-edit/index.js | 9+++++++--
Msrc/lib/leaflet.polyline-measure/index.js | 3++-
29 files changed, 179 insertions(+), 63 deletions(-)

diff --git a/scripts/build.js b/scripts/build.js @@ -14,7 +14,11 @@ const paths = require('../webpack/paths'); function getVersionFromGit() { const verCmd = - "echo -n `date +%Y-%m-%d_%H:%M:%S`-`git rev-parse --abbrev-ref HEAD`-`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`"; + 'echo -n ' + + '`date +%Y-%m-%d_%H:%M:%S`-' + + '`git rev-parse --abbrev-ref HEAD`-' + + '`git rev-parse --short HEAD`' + + '`git diff-index --quiet HEAD -- || echo -dirty`'; return execSync(verCmd).toString(); } diff --git a/src/layers.js b/src/layers.js @@ -550,7 +550,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; }, { title: 'Mountains by Aleksey Tsvetkov', - description: 'Tian Shan, Dzungaria, <a href="http://pereval.g-utka.ru/">http://pereval.g-utka.ru/</a>', + description: + 'Tian Shan, Dzungaria, <a href="http://pereval.g-utka.ru/">http://pereval.g-utka.ru/</a>', isDefault: false, layer: L.tileLayer("http://nakartetiles.s3-website.eu-central-1.amazonaws.com/{z}/{x}/{y}.png", // FIXME: сделать minZoom=5, когда перейдём на версию leaflet с поддержкой minNativeZoom @@ -612,7 +613,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; { title: 'Strava heatmap (all)', isDefault: false, - layer: new StravaHeatmap('https://heatmap-external-{s}.strava.com/tiles-auth/all/hot/{z}/{x}/{y}.png?px=256', + layer: new StravaHeatmap( + 'https://heatmap-external-{s}.strava.com/tiles-auth/all/hot/{z}/{x}/{y}.png?px=256', { code: 'Sa', isOverlay: true, @@ -628,7 +630,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; { title: 'Strava heatmap (run)', isDefault: false, - layer: new StravaHeatmap('https://heatmap-external-{s}.strava.com/tiles-auth/run/hot/{z}/{x}/{y}.png?px=256', + layer: new StravaHeatmap( + 'https://heatmap-external-{s}.strava.com/tiles-auth/run/hot/{z}/{x}/{y}.png?px=256', { code: 'Sr', isOverlay: true, @@ -644,7 +647,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; { title: 'Strava heatmap (ride)', isDefault: false, - layer: new StravaHeatmap('https://heatmap-external-{s}.strava.com/tiles-auth/ride/hot/{z}/{x}/{y}.png?px=256', + layer: new StravaHeatmap( + 'https://heatmap-external-{s}.strava.com/tiles-auth/ride/hot/{z}/{x}/{y}.png?px=256', { code: 'Sb', isOverlay: true, @@ -660,7 +664,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; { title: 'Strava heatmap (winter)', isDefault: false, - layer: new StravaHeatmap('https://heatmap-external-{s}.strava.com/tiles-auth/winter/hot/{z}/{x}/{y}.png?px=256', + layer: new StravaHeatmap( + 'https://heatmap-external-{s}.strava.com/tiles-auth/winter/hot/{z}/{x}/{y}.png?px=256', { code: 'Sw', isOverlay: true, @@ -724,7 +729,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; { title: 'Strava heatmap lowres (winter)', isDefault: false, - layer: L.tileLayer('https://heatmap-external-{s}.strava.com/tiles/winter/hot/{z}/{x}/{y}.png?px=256', + layer: L.tileLayer( + 'https://heatmap-external-{s}.strava.com/tiles/winter/hot/{z}/{x}/{y}.png?px=256', { code: 'Swl', isOverlay: true, @@ -740,7 +746,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; { title: 'Norway paper map', isDefault: false, - layer: new L.TileLayer('https://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=toporaster3&zoom={z}&x={x}&y={y}', + layer: new L.TileLayer( + 'https://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=toporaster3&zoom={z}&x={x}&y={y}', // eslint-disable-line max-len { code: 'Np', isOverlay: true, @@ -758,7 +765,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; { title: 'Norway topo', isDefault: false, - layer: new L.TileLayer('https://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo4&zoom={z}&x={x}&y={y}', + layer: new L.TileLayer( + 'https://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo4&zoom={z}&x={x}&y={y}', { code: 'Nm', isOverlay: true, @@ -844,7 +852,10 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; title: 'Finland Topo', description: '<a href="https://www.retkikartta.fi/?lang=en">https://www.retkikartta.fi/</a>', isDefault: false, - layer: L.tileLayer("https://retkikartta.fi/wmts/30c616a00f157e7357721900e8b0415c?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=maastokartta&STYLE=default&TILEMATRIXSET=WGS84_Pseudo-Mercator&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=image/png", + layer: L.tileLayer( + "https://retkikartta.fi/wmts/30c616a00f157e7357721900e8b0415c?" + + "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=maastokartta&STYLE=default&" + + "TILEMATRIXSET=WGS84_Pseudo-Mercator&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=image/png", { code: 'Fmk', isOverlay: false, @@ -860,7 +871,11 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; { title: 'France Topo 250m', isDefault: false, - layer: L.tileLayer("https://wxs.ign.fr/an7nvfzojv5wa96dsga5nk8w/geoportail/wmts?layer=GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN25TOUR.CV&style=normal&tilematrixset=PM&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg&TileMatrix={z}&TileCol={x}&TileRow={y}", + layer: L.tileLayer( + "https://wxs.ign.fr/an7nvfzojv5wa96dsga5nk8w/geoportail/wmts?" + + "layer=GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN25TOUR.CV&style=normal&tilematrixset=PM&" + + "Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg&" + + "TileMatrix={z}&TileCol={x}&TileRow={y}", { minZoom: 6, maxNativeZoom: 16, @@ -897,7 +912,8 @@ import {StravaHeatmap} from '~/lib/leaflet.layer.strava-heatmap'; }, { title: 'Waymarked Cycling Trails', - description: '<a href="https://cycling.waymarkedtrails.org/">https://cycling.waymarkedtrails.org</a>', + description: + '<a href="https://cycling.waymarkedtrails.org/">https://cycling.waymarkedtrails.org</a>', isDefault: false, layer: L.tileLayer('https://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png', { diff --git a/src/lib/leaflet.control.coordinates/formats.js b/src/lib/leaflet.control.coordinates/formats.js @@ -67,7 +67,8 @@ const DEGREES_AND_MINUTES_AND_SECONDS = { code: 'DMS', label: 'ddd°mm′ss.s″', wrapperClass: 'leaflet-coordinates-wrapper-degrees-and-minutes-and-seconds', - formatter: ({intDegrees, intMinutes, seconds, direction}) => `${direction} ${intDegrees}°${intMinutes}′${seconds}″`}; + formatter: ({intDegrees, intMinutes, seconds, direction}) => `${direction} ${intDegrees}°${intMinutes}′${seconds}″` +}; export default { SIGNED_DEGREES, diff --git a/src/lib/leaflet.control.coordinates/index.js b/src/lib/leaflet.control.coordinates/index.js @@ -78,7 +78,8 @@ L.Control.Coordinates = L.Control.extend({ <div data-bind="foreach: formats"> <div> <label title=""> - <input type="radio" data-bind="checked: $parent.formatCode, value: code" class="leaflet-coordinates-format-radio"/> + <input type="radio" data-bind="checked: $parent.formatCode, value: code" + class="leaflet-coordinates-format-radio"/> <span data-bind="html: label"></span> </label> </div> diff --git a/src/lib/leaflet.control.elevation-profile/index.js b/src/lib/leaflet.control.elevation-profile/index.js @@ -271,7 +271,9 @@ const ElevationProfile = L.Class.extend({ this.updateGraph(); const icon = L.divIcon({ className: 'elevation-profile-marker', - html: '<div class="elevation-profile-marker-icon"></div><div class="elevation-profile-marker-label"></div>' + html: + '<div class="elevation-profile-marker-icon"></div>' + + '<div class="elevation-profile-marker-label"></div>' } ); this.trackMarker = L.marker([1000, 0], {interactive: false, icon: icon}); @@ -905,7 +907,11 @@ const ElevationProfile = L.Class.extend({ for (i = 0; i < gridValues.length; i++) { y = Math.round(i * gridStep - 0.5) + 0.5 + paddingTop; path = L.Util.template('M{x1} {y} L{x2} {y}', {x1: 0, x2: this.svgWidth * this.horizZoom, y: y}); - createSvg('path', {d: path, 'stroke-width': '1px', stroke: 'green', fill: 'none', 'stroke-opacity': '0.5'}, svg); + createSvg( + 'path', + {'d': path, 'stroke-width': '1px', 'stroke': 'green', 'fill': 'none', 'stroke-opacity': '0.5'}, + svg + ); label = L.DomUtil.create('div', 'elevation-profile-grid-label', this.leftAxisLables); label.innerHTML = gridValues[gridValues.length - i - 1]; diff --git a/src/lib/leaflet.control.jnx/index.js b/src/lib/leaflet.control.jnx/index.js @@ -66,7 +66,7 @@ L.Control.JNX = L.Control.extend({ let resolutionString = metersPerPixel.toFixed(2); let sizeString = fileSizeMb.toFixed(fileSizeMb > 1 ? 0 : 1); let item = { - text: `<span class="${itemClass}">Zoom ${zoom} (${resolutionString} m/pixel) &mdash; ${tilesCount} tiles (~${sizeString} Mb)</span>`, + text: `<span class="${itemClass}">Zoom ${zoom} (${resolutionString} m/pixel) &mdash; ${tilesCount} tiles (~${sizeString} Mb)</span>`, // eslint-disable-line max-len callback: () => this.makeJnx(layer, layerName, zoom), disabled: this.makingJnx() }; diff --git a/src/lib/leaflet.control.layers.adaptive-height/index.js b/src/lib/leaflet.control.layers.adaptive-height/index.js @@ -26,7 +26,8 @@ function enableAdaptiveHeight(control) { let maxHeight; maxHeight = (mapHeight - this._container.offsetTop // controls above - - (this._container.parentNode.offsetHeight - this._container.offsetTop - this._container.offsetHeight) //controls below + - (this._container.parentNode.offsetHeight - this._container.offsetTop - + this._container.offsetHeight) //controls below - 70); // margin this._form.style.maxHeight = maxHeight + 'px'; } diff --git a/src/lib/leaflet.control.layers.configure/index.js b/src/lib/leaflet.control.layers.configure/index.js @@ -289,6 +289,7 @@ function enableConfig(control, {layers, customLayersOrder}) { } }; +/* eslint-disable max-len */ const formHtml = ` <p><a class="doc-link" href="http://leafletjs.com/reference-1.0.2.html#tilelayer" target="_blank">See Leaflet TileLayer documentation for url format</a></p> <label>Layer name<br/><input data-bind="value: name"/></label><br/> @@ -309,6 +310,7 @@ function enableConfig(control, {layers, customLayersOrder}) { <div data-bind="foreach: buttons"> <a class="button" data-bind="click: $root.buttonClicked.bind(null, $index()), text: caption"></a> </div>`; +/* eslint-enable max-len */ form.innerHTML = formHtml; ko.applyBindings(dialogModel, form); }, @@ -318,7 +320,9 @@ function enableConfig(control, {layers, customLayersOrder}) { if (obj.layer.__customLayer) { const editButton = L.DomUtil.create('div', 'custom-layer-edit-button icon-edit', label.children[0]); editButton.title = 'Edit layer'; - L.DomEvent.on(editButton, 'click', (e) => this.onCustomLayerEditClicked(obj.layer.__customLayer, e)); + L.DomEvent.on(editButton, 'click', (e) => + this.onCustomLayerEditClicked(obj.layer.__customLayer, e) + ); } if (obj.layer._justAdded) { L.DomUtil.addClass(label, 'leaflet-layers-configure-just-added-1'); @@ -412,7 +416,8 @@ function enableConfig(control, {layers, customLayersOrder}) { isCustom: true, serialized: serialized, layer: tileLayer, - order: (fieldValues.isOverlay && fieldValues.isTop) ? customLayersOrder.top : customLayersOrder.bottom, + order: + (fieldValues.isOverlay && fieldValues.isTop) ? customLayersOrder.top : customLayersOrder.bottom, fieldValues: fieldValues, enabled: true, checked: ko.observable(true) @@ -436,8 +441,11 @@ function enableConfig(control, {layers, customLayersOrder}) { onCustomLayerEditClicked: function(layer, e) { L.DomEvent.stop(e); this.showCustomLayerForm([ - {caption: 'Save', callback: (fieldValues) => this.onCustomLayerChangeClicked(layer, fieldValues)}, - {caption: 'Delete', callback: () => this.onCustomLayerDeletelClicked(layer)}, + { + caption: 'Save', + callback: (fieldValues) => this.onCustomLayerChangeClicked(layer, fieldValues), + }, + {caption: 'Delete', callback: () => this.onCustomLayerDeletelClicked(layer)}, {caption: 'Cancel', callback: () => this.onCustomLayerCancelClicked()} ], layer.fieldValues ); @@ -464,7 +472,10 @@ function enableConfig(control, {layers, customLayersOrder}) { const newLayer = this.createCustomLayer(newFieldValues); this._customLayers.splice(layerPos, 0, newLayer); - if (this._map.hasLayer(layer.layer) && (!layer.layer.options.isOverlay || newLayer.layer.options.isOverlay)) { + if ( + this._map.hasLayer(layer.layer) && + (!layer.layer.options.isOverlay || newLayer.layer.options.isOverlay) + ) { this._map.addLayer(newLayer.layer); } this._map.removeLayer(layer.layer); diff --git a/src/lib/leaflet.control.locate/index.js b/src/lib/leaflet.control.locate/index.js @@ -103,7 +103,7 @@ const LocateControl = L.Control.extend({ // if button turned off -- turn on, maps follows marker // if button turned on // if map is following marker -- turn off - // if map not following marker -- center map at marker, start following + // if map not following marker -- center map at marker, start following options: { locationAcquireTimeoutMS: Infinity, @@ -145,7 +145,9 @@ const LocateControl = L.Control.extend({ } if (storedPosition) { - this._map.setView(forceLatLng ? forceLatLng : storedPosition, forceZoom ? forceZoom : zoom, {animate: false}); + this._map.setView(forceLatLng ? forceLatLng : storedPosition, forceZoom ? forceZoom : zoom, { + animate: false, + }); if (!('geolocation' in navigator)) { return; } @@ -154,7 +156,9 @@ const LocateControl = L.Control.extend({ this._storePositionToLocalStorage(pos); if (!forceLatLng) { // TODO: check if map has not moved - this._map.setView(L.latLng(pos.coords.latitude, pos.coords.longitude), zoom, {animate: false}); + this._map.setView(L.latLng(pos.coords.latitude, pos.coords.longitude), zoom, { + animate: false, + }); } }, (e) => { @@ -232,14 +236,15 @@ const LocateControl = L.Control.extend({ if (!this._map || !this._latlng) { return; } - + // autoZoom -- to fit accuracy cirlce on screen, but not more then options.maxAutoZoom (17) // if current zoom more then options.minAutoZoomDeltaForAuto less then autoZoom, set autoZoom // if map center far from geolocation, set autoZoom // if map center not far from geolocation - // if accuracy circle does not fit at current zoom, zoom out to fit - // if current zoom is less then minAutoZoomDeltaForAuto less then autoZoom or >= autoZoom and circle fits screen, keep current zoom - + // if accuracy circle does not fit at current zoom, zoom out to fit + // if current zoom is less then minAutoZoomDeltaForAuto less then autoZoom + // or >= autoZoom and circle fits screen, keep current zoom + const currentZoom = this._map.getZoom(); let zoomFitAccuracy = this._map.getBoundsZoom(this._latlng.toBounds(this._accuracy * 2)); let autoZoom = zoomFitAccuracy; diff --git a/src/lib/leaflet.control.panoramas/index.js b/src/lib/leaflet.control.panoramas/index.js @@ -218,7 +218,8 @@ L.Control.Panoramas = L.Control.extend({ } L.DomUtil.addClass(provider.container, 'enabled'); if (!provider.viewer) { - provider.viewer = await provider.provider.getViewer(provider.container); // eslint-disable-line require-atomic-updates + // eslint-disable-next-line require-atomic-updates + provider.viewer = await provider.provider.getViewer(provider.container); this.setupViewerEvents(provider); } if (data) { diff --git a/src/lib/leaflet.control.panoramas/lib/google/index.js b/src/lib/leaflet.control.panoramas/lib/google/index.js @@ -4,7 +4,7 @@ import getGoogle from '~/lib/googleMapsApi'; function getCoverageLayer(options) { return L.tileLayer( - 'https://maps.googleapis.com/maps/vt?pb=!1m5!1m4!1i{z}!2i{x}!3i{y}!4i256!2m8!1e2!2ssvv!4m2!1scb_client!2sapiv3!4m2!1scc!2s*211m3*211e3*212b1*213e2*211m3*211e2*212b1*213e2!3m5!3sUS!12m1!1e40!12m1!1e18!4e0', + 'https://maps.googleapis.com/maps/vt?pb=!1m5!1m4!1i{z}!2i{x}!3i{y}!4i256!2m8!1e2!2ssvv!4m2!1scb_client!2sapiv3!4m2!1scc!2s*211m3*211e3*212b1*213e2*211m3*211e2*212b1*213e2!3m5!3sUS!12m1!1e40!12m1!1e18!4e0', // eslint-disable-line max-len options ); } diff --git a/src/lib/leaflet.control.panoramas/lib/mapillary/index.js b/src/lib/leaflet.control.panoramas/lib/mapillary/index.js @@ -20,7 +20,8 @@ function getMapillary() { async function getPanoramaAtPos(latlng, searchRadiusMeters) { - const url = `https://a.mapillary.com/v3/images?client_id=${config.mapillary}&closeto=${latlng.lng},${latlng.lat}&radius=${searchRadiusMeters}`; + const url = `https://a.mapillary.com/v3/images?` + + `client_id=${config.mapillary}&closeto=${latlng.lng},${latlng.lat}&radius=${searchRadiusMeters}`; const resp = await fetch(url, {responseType: 'json', timeout: 10000}); if (resp.status === 200 && resp.responseJSON.features.length) { return {found: true, data: resp.responseJSON.features[0].properties.key}; @@ -147,7 +148,7 @@ const Viewer = L.Evented.extend({ this._zoom.toFixed(2) ]; }, - + setState: function(state) { const lat = parseFloat(state[0]); const lng = parseFloat(state[1]); diff --git a/src/lib/leaflet.control.panoramas/lib/wikimedia/index.js b/src/lib/leaflet.control.panoramas/lib/wikimedia/index.js @@ -34,10 +34,18 @@ function parseSearchResponse(resp) { // eslint-disable-line complexity imageDescription = imageDescription.replace(/<[^>]+>/ug, ''); imageDescription = imageDescription.replace(/[\n\r]/ug, ''); } - if (imageDescription && objectDescription && objectDescription.toLowerCase().includes(imageDescription.toLowerCase())) { + if ( + imageDescription && + objectDescription && + objectDescription.toLowerCase().includes(imageDescription.toLowerCase()) + ) { imageDescription = null; } - if (objectDescription && imageDescription && imageDescription.toLowerCase().includes(objectDescription.toLowerCase())) { + if ( + objectDescription && + imageDescription && + imageDescription.toLowerCase().includes(objectDescription.toLowerCase()) + ) { objectDescription = null; } let description = 'Wikimedia commons'; diff --git a/src/lib/leaflet.control.printPages/decoration.grid.js b/src/lib/leaflet.control.printPages/decoration.grid.js @@ -78,7 +78,10 @@ class Grid extends PrintStaticLayer { } const lineWidthMm = 0.15; let lineWidthPx = lineWidthMm * pixelsPerMm; - for (let {color, offset} of [{color: '#D9D9D9', offset: lineWidthPx / 2}, {color: '#8C8C8C', offset: -lineWidthPx / 2}]) { + for (let {color, offset} of [ + {color: '#D9D9D9', offset: lineWidthPx / 2}, + {color: '#8C8C8C', offset: -lineWidthPx / 2}, + ]) { ctx.beginPath(); ctx.lineWidth = lineWidthPx; diff --git a/src/lib/leaflet.control.printPages/decoration.magnetic-meridians.js b/src/lib/leaflet.control.printPages/decoration.magnetic-meridians.js @@ -35,7 +35,10 @@ class MagneticMeridians extends PrintStaticLayer { ctx.lineWidth = this.lineThicknessMm / 25.4 * printOptions.resolution; const intervalPx = this.lineIntervalMm / 25.4 * printOptions.resolution; const samplingPx = this.samplingIntervalMm / 25.4 * printOptions.resolution; - const pageDiagonal = Math.sqrt(printOptions.destPixelSize.x * printOptions.destPixelSize.x + printOptions.destPixelSize.y * printOptions.destPixelSize.y); + const pageDiagonal = Math.sqrt( + printOptions.destPixelSize.x * printOptions.destPixelSize.x + + printOptions.destPixelSize.y * printOptions.destPixelSize.y + ); const maxSegments = pageDiagonal / 2 / samplingPx; function drawLine(p, directionDown) { diff --git a/src/lib/leaflet.control.printPages/decoration.scale.js b/src/lib/leaflet.control.printPages/decoration.scale.js @@ -16,7 +16,10 @@ function pageScaleRange(printOptions) { function formatScale(nominalScale, scaleRange) { const threshold = 0.05; - if (Math.abs(nominalScale - scaleRange.min) / nominalScale > threshold || Math.abs(nominalScale - scaleRange.max) / nominalScale > threshold) { + if ( + Math.abs(nominalScale - scaleRange.min) / nominalScale > threshold || + Math.abs(nominalScale - scaleRange.max) / nominalScale > threshold + ) { let unit; scaleRange = Object.assign({}, scaleRange); if (scaleRange.min >= 1000) { diff --git a/src/lib/leaflet.control.printPages/map-render.js b/src/lib/leaflet.control.printPages/map-render.js @@ -180,7 +180,16 @@ class PageComposer { } } -async function* iterateLayersTiles(layers, latLngBounds, destPixelSize, resolution, scale, zooms, pageLabel, pagesCount) { +async function* iterateLayersTiles( + layers, + latLngBounds, + destPixelSize, + resolution, + scale, + zooms, + pageLabel, + pagesCount +) { const defaultXHROptions = { responseType: 'blob', timeout: 20000, diff --git a/src/lib/leaflet.control.printPages/pageFeature.js b/src/lib/leaflet.control.printPages/pageFeature.js @@ -38,7 +38,8 @@ const PageFeature = L.Marker.extend({ const centerLatLng = this.getLatLng(); const centerMerc = L.Projection.SphericalMercator.project(centerLatLng); - const mercatorScale = Math.cos(centerLatLng.lat * Math.PI / 180) * L.CRS.Earth.R / L.Projection.SphericalMercator.R; + const mercatorScale = + (Math.cos((centerLatLng.lat * Math.PI) / 180) * L.CRS.Earth.R) / L.Projection.SphericalMercator.R; const mercatorPageSize = L.point(...this.paperSize).multiplyBy(this.scale / 10 / mercatorScale); let sw = centerMerc.subtract(mercatorPageSize.divideBy(2)); let ne = centerMerc.add(mercatorPageSize.divideBy(2)); diff --git a/src/lib/leaflet.control.track-list/lib/geo_file_exporters.js b/src/lib/leaflet.control.track-list/lib/geo_file_exporters.js @@ -28,8 +28,16 @@ function splitLineAt180Meridian(latLngs) { let positivePrevLng = L.Util.wrapNum(prevLatLng.lng, [0, 360]); let splitLng = 180 - 0.000001 * Math.sign(latLng.lng); let splitPrevLng = 180 - 0.000001 * Math.sign(prevLatLng.lng); - let splitLat = getSegmentLatForLng(L.latLng(prevLatLng.lat, positivePrevLng), L.latLng(latLng.lat, positiveLng), splitLng); - let splitPrevLat = getSegmentLatForLng(L.latLng(prevLatLng.lat, positivePrevLng), L.latLng(latLng.lat, positiveLng), splitPrevLng); + let splitLat = getSegmentLatForLng( + L.latLng(prevLatLng.lat, positivePrevLng), + L.latLng(latLng.lat, positiveLng), + splitLng + ); + let splitPrevLat = getSegmentLatForLng( + L.latLng(prevLatLng.lat, positivePrevLng), + L.latLng(latLng.lat, positiveLng), + splitPrevLng + ); newLine.push(L.latLng(splitPrevLat, splitPrevLng).wrap()); newLine = [L.latLng(splitLat, splitLng).wrap(), latLng]; newLines.push(newLine); @@ -53,7 +61,9 @@ function saveGpx(segments, name, points) { gpx.push('<?xml version="1.0" encoding="UTF-8" standalone="no" ?>'); gpx.push( - '<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="http://nakarte.me" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1">' + '<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="http://nakarte.me" ' + + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' + + 'http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1">' ); points.forEach(function(marker) { var label = marker.label; diff --git a/src/lib/leaflet.control.track-list/lib/services/gpsies.js b/src/lib/leaflet.control.track-list/lib/services/gpsies.js @@ -35,7 +35,8 @@ class Gpsies extends BaseService { parseResponse(responses) { const response = responses[0]; - return parseGpx(response.responseBinaryText, this.nameFromUrl(response.responseURL), true) || [{name: name, error: 'UNSUPPORTED'}]; + return parseGpx(response.responseBinaryText, this.nameFromUrl(response.responseURL), true) + || [{name: name, error: 'UNSUPPORTED'}]; } } diff --git a/src/lib/leaflet.control.track-list/lib/services/gpslib.js b/src/lib/leaflet.control.track-list/lib/services/gpslib.js @@ -20,7 +20,8 @@ class Gpslib extends BaseService { parseResponse(responses) { const response = responses[0]; - return parseGpx(response.responseBinaryText, `GPSLib ${this.trackId}`, true) || [{name: name, error: 'UNSUPPORTED'}]; + return parseGpx(response.responseBinaryText, `GPSLib ${this.trackId}`, true) + || [{name: name, error: 'UNSUPPORTED'}]; } } diff --git a/src/lib/leaflet.control.track-list/lib/services/osm.js b/src/lib/leaflet.control.track-list/lib/services/osm.js @@ -25,7 +25,8 @@ class Osm extends BaseService { parseResponse(responses) { const trackId = this.getTrackId(); const response = responses[0]; - return parseGpx(response.responseBinaryText, `OSM track ${trackId}`, true) || [{name: name, error: 'UNSUPPORTED'}]; + return parseGpx(response.responseBinaryText, `OSM track ${trackId}`, true) + || [{name: name, error: 'UNSUPPORTED'}]; } } diff --git a/src/lib/leaflet.control.track-list/lib/services/sportstracker.js b/src/lib/leaflet.control.track-list/lib/services/sportstracker.js @@ -16,7 +16,9 @@ class SportsTrackerActivity extends SportsTrackerBase { const activityId = m[3]; return [ { - url: urlViaCorsProxy(`https://www.sports-tracker.com/apiserver/v1/workouts/${activityId}/data?samples=100000`), + url: urlViaCorsProxy( + `https://www.sports-tracker.com/apiserver/v1/workouts/${activityId}/data?samples=100000` + ), options: { responseType: 'binarystring', isResponseSuccess: (xhr) => xhr.status === 200 || xhr.status === 403 diff --git a/src/lib/leaflet.control.track-list/track-list.js b/src/lib/leaflet.control.track-list/track-list.js @@ -68,6 +68,7 @@ L.Control.TrackList = L.Control.extend({ var container = this._container = L.DomUtil.create('div', 'leaflet-control leaflet-control-tracklist'); this._stopContainerEvents(); + /* eslint-disable max-len */ container.innerHTML = ` <div class="leaflet-control-button-toggle" data-bind="click: setExpanded" title="Load, edit and save tracks"></div> @@ -116,6 +117,7 @@ L.Control.TrackList = L.Control.extend({ </div> </div> `; + /* eslint-enable max-len */ ko.applyBindings(this, container); // FIXME: add onRemove method and unsubscribe @@ -153,7 +155,8 @@ L.Control.TrackList = L.Control.extend({ let maxHeight; maxHeight = (mapHeight - this._container.offsetTop // controls above - - (this._container.parentNode.offsetHeight - this._container.offsetTop - this._container.offsetHeight) //controls below + - (this._container.parentNode.offsetHeight - this._container.offsetTop + - this._container.offsetHeight) //controls below - 105); // margin this.trackListHeight(maxHeight + 'px'); }, @@ -280,7 +283,8 @@ L.Control.TrackList = L.Control.extend({ messages.push('No tracks loaded'); } geodata_array.forEach(function(geodata) { - var data_empty = !((geodata.tracks && geodata.tracks.length) || (geodata.points && geodata.points.length)); + var data_empty = !((geodata.tracks && geodata.tracks.length) + || (geodata.points && geodata.points.length)); if (!data_empty) { if (geodata.tracks) { @@ -429,8 +433,8 @@ L.Control.TrackList = L.Control.extend({ attachColorSelector: function(track) { var items = this.colors.map(function(color, index) { return { - text: '<div style="display: inline-block; vertical-align: middle; width: 50px; height: 0; border-top: 4px solid ' + - color + '"></div>', + text: '<div style="display: inline-block; vertical-align: middle; width: 50px; height: 0; ' + + 'border-top: 4px solid ' + color + '"></div>', callback: track.color.bind(null, index) }; } @@ -1125,7 +1129,10 @@ L.Control.TrackList = L.Control.extend({ } ); var bounds = track.feature.getBounds(); - var capturedBounds = [[bounds.getSouth(), bounds.getWest()], [bounds.getNorth(), bounds.getEast()]]; + var capturedBounds = [ + [bounds.getSouth(), bounds.getWest()], + [bounds.getNorth(), bounds.getEast()] + ]; return { color: track.color(), visible: track.visible(), diff --git a/src/lib/leaflet.layer.bing/index.js b/src/lib/leaflet.layer.bing/index.js @@ -103,7 +103,10 @@ const BingLayer = L.TileLayer.extend({ }, _update_attribution: function () { - var bounds = L.latLngBounds(this._map.getBounds().getSouthWest().wrap(), this._map.getBounds().getNorthEast().wrap()); + var bounds = L.latLngBounds( + this._map.getBounds().getSouthWest().wrap(), + this._map.getBounds().getNorthEast().wrap() + ); var zoom = this._map.getZoom(); for (var i = 0; i < this._providers.length; i++) { var p = this._providers[i]; diff --git a/src/lib/leaflet.layer.strava-heatmap/index.js b/src/lib/leaflet.layer.strava-heatmap/index.js @@ -6,16 +6,20 @@ const StravaHeatmap = L.TileLayer.extend({ _checkUserLoggedIn: function() { const message = ` Для просмотра тепловой карты треков необходимо зарегистрироваться и залогиниться на сайте - <a title="Откроется в новом окне" target="_blank" href="https://strava.com/login">https://strava.com/login</a>, + <a title="Откроется в новом окне" target="_blank" href="https://strava.com/login"> + https://strava.com/login</a>, затем открыть карту на оригинальном сайте - <a title="Откроется в новом окне" target="_blank" href="https://www.strava.com/heatmap">https://www.strava.com/heatmap</a>, + <a title="Откроется в новом окне" target="_blank" href="https://www.strava.com/heatmap"> + https://www.strava.com/heatmap</a>, после чего перезагрузить эту страницу.<br> Если вы не хотите регистририваться в сервисе Strava, вы можете выбрать в настройках слои с низким разрешением "Strava&nbsp;heatmap&nbsp;lowres", они доступны всем пользователям.<br><br> You have to login at - <a title="Will open in new window" target="_blank" href="https://strava.com/login">https://strava.com/login</a> - and then open <a title="Will open in new window" target="_blank" href="https://www.strava.com/heatmap">https://www.strava.com/heatmap</a> to be able to view tracks heatmap. + <a title="Will open in new window" target="_blank" href="https://strava.com/login"> + https://strava.com/login</a> + and then open <a title="Will open in new window" target="_blank" href="https://www.strava.com/heatmap"> + https://www.strava.com/heatmap</a> to be able to view tracks heatmap. Alternatively you can select low resolution layers in layers settings.`; const data = { diff --git a/src/lib/leaflet.layer.westraPasses/westraPassesMarkers.js b/src/lib/leaflet.layer.westraPasses/westraPassesMarkers.js @@ -64,7 +64,11 @@ const WestraPassesMarkers = L.Layer.CanvasMarkers.extend({ } label = escapeHtml(label); const gpx = `<?xml version="1.0" encoding="UTF-8" standalone="no" ?> - <gpx xmlns="http://www.topografix.com/GPX/1/1" creator="http://nakarte.me" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1"> + <gpx xmlns="http://www.topografix.com/GPX/1/1" + creator="http://nakarte.me" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" + version="1.1"> <wpt lat="${marker.latlng.lat.toFixed(6)}" lon="${marker.latlng.lng.toFixed(6)}"> <name>${label}</name> </wpt> @@ -172,7 +176,10 @@ const WestraPassesMarkers = L.Layer.CanvasMarkers.extend({ } let reports; if (properties.reports_total) { - reports = `<br>Отчетов: ${properties.reports_total}, с фото: ${properties.reports_photo || 0}, с описанием: ${properties.reports_tech || 0}`; + reports = + `<br>Отчетов: ${properties.reports_total}, ` + + `с фото: ${properties.reports_photo || 0}, ` + + `с описанием: ${properties.reports_tech || 0}`; } else { reports = '<br>Отчетов нет'; } diff --git a/src/lib/leaflet.polyline-edit/index.js b/src/lib/leaflet.polyline-edit/index.js @@ -201,7 +201,10 @@ L.Polyline.EditMixin = { makeNodeMarker: function(nodeIndex) { var node = this.getLatLngs()[nodeIndex], marker = L.marker(node.clone(), { - icon: L.divIcon({className: 'line-editor-node-marker-halo', 'html': '<div class="line-editor-node-marker"></div>'}), + icon: L.divIcon({ + className: 'line-editor-node-marker-halo', + 'html': '<div class="line-editor-node-marker"></div>' + }), draggable: true, zIndexOffset: this._nodeMarkersZOffset, projectedShift: () => this.shiftProjectedFitMapView() @@ -369,7 +372,9 @@ L.Polyline.EditMixin = { const startIndex = this._drawingDirection === -1 ? 1 : 0; const endIndex = this._drawingDirection === 1 ? nodesCount - 2 : nodesCount - 1; const startIcon = this._latlngs[startIndex]._nodeMarker._icon; - L.DomUtil[this._drawingDirection !== -1 ? 'addClass' : 'removeClass'](startIcon, 'line-editor-node-marker-start'); + L.DomUtil[this._drawingDirection !== -1 ? 'addClass' : 'removeClass']( + startIcon, 'line-editor-node-marker-start' + ); if (endIndex >= 0) { const endIcon = this._latlngs[endIndex]._nodeMarker._icon; let func; diff --git a/src/lib/leaflet.polyline-measure/index.js b/src/lib/leaflet.polyline-measure/index.js @@ -65,7 +65,8 @@ L.MeasuredLine = L.Polyline.extend({ var labelText = Math.round((tick.distanceValue / 10)) / 100 + ' km', icon = L.divIcon( { - html: '<div class="measure-tick-icon-text" style="transform:' + transformMatrixString + '">' + + html: '<div class="measure-tick-icon-text" style="transform:' + + transformMatrixString + '">' + labelText + '</div>', className: 'measure-tick-icon' }