Update prettier version

This commit is contained in:
Gautier P 2020-12-05 11:50:30 +01:00
parent c49b821db7
commit 25429b3c24
42 changed files with 2480 additions and 2490 deletions

View file

@ -7,17 +7,17 @@ BR.CircleGoArea = L.Control.extend({
shortcut: {
draw: {
enable: 73, // char code for 'i'
disable: 27 // char code for 'ESC'
}
}
disable: 27, // char code for 'ESC'
},
},
},
initialize: function(routing, nogos, pois) {
initialize: function (routing, nogos, pois) {
this.routing = routing;
this.nogos = nogos;
this.pois = pois;
},
onAdd: function(map) {
onAdd: function (map) {
var self = this;
this.map = map;
@ -29,29 +29,29 @@ BR.CircleGoArea = L.Control.extend({
{
stateName: 'activate-circlego',
icon: 'fa-circle-o',
onClick: function() {
onClick: function () {
self.draw(true);
},
title: i18next.t('keyboard.generic-shortcut', {
action: i18next.t('map.draw-circlego-start', { radius: radiusKm }),
key: 'I'
})
key: 'I',
}),
},
{
stateName: 'deactivate-circlego',
icon: 'fa-circle-o active',
onClick: function() {
onClick: function () {
self.draw(false);
},
title: i18next.t('keyboard.generic-shortcut', {
action: i18next.t('map.draw-circlego-stop', { radius: radiusKm }),
key: '$t(keyboard.escape)'
})
}
]
key: '$t(keyboard.escape)',
}),
},
],
});
map.on('routing:draw-start', function() {
map.on('routing:draw-start', function () {
self.draw(false);
});
@ -61,7 +61,7 @@ BR.CircleGoArea = L.Control.extend({
return container;
},
draw: function(enable) {
draw: function (enable) {
this.drawButton.state(enable ? 'deactivate-circlego' : 'activate-circlego');
if (enable) {
this.routing.draw(false);
@ -74,7 +74,7 @@ BR.CircleGoArea = L.Control.extend({
}
},
_keydownListener: function(e) {
_keydownListener: function (e) {
if (!BR.Util.keyboardShortcutsAllowed(e)) {
return;
}
@ -85,7 +85,7 @@ BR.CircleGoArea = L.Control.extend({
}
},
setNogoCircle: function(center) {
setNogoCircle: function (center) {
if (center) {
var polygon = this.circleToPolygon(center, this.options.radius);
var geoJson = JSON.stringify(polygon);
@ -101,9 +101,15 @@ BR.CircleGoArea = L.Control.extend({
}
},
setOutsideArea: function(polygon) {
setOutsideArea: function (polygon) {
var inner = polygon.features[0].geometry.coordinates.concat(polygon.features[1].geometry.coordinates);
var world = [[180, 90], [-180, 90], [-180, -90], [180, -90], [180, 90]];
var world = [
[180, 90],
[-180, 90],
[-180, -90],
[180, -90],
[180, 90],
];
polygon.features[0].geometry.coordinates = [world, inner];
polygon.features[0].geometry.type = 'Polygon';
polygon.features.pop();
@ -114,36 +120,36 @@ BR.CircleGoArea = L.Control.extend({
this.outsideArea = L.geoJson(polygon, {
renderer: this.outsideAreaRenderer,
style: function(feature) {
style: function (feature) {
return {
weight: 2,
color: 'black',
opacity: 0.4,
fillColor: 'black',
fillOpacity: 0.4,
className: 'circlego-outside'
className: 'circlego-outside',
};
}
},
})
.on('click', L.DomEvent.stop)
.addTo(this.map);
},
onMapClick: function(e) {
onMapClick: function (e) {
this.setCircle([e.latlng.lng, e.latlng.lat], false);
},
setCircle: function(center, skipNogo) {
setCircle: function (center, skipNogo) {
var self = this;
var icon = L.VectorMarkers.icon({
icon: 'home',
markerColor: BR.conf.markerColors.circlego
markerColor: BR.conf.markerColors.circlego,
});
var marker = L.marker([center[1], center[0]], { icon: icon, draggable: true, name: name })
.on('dragend', function(e) {
.on('dragend', function (e) {
self.setNogoCircle([e.target.getLatLng().lng, e.target.getLatLng().lat]);
})
.on('click', function() {
.on('click', function () {
var drawing = self.drawButton.state() == 'deactivate-circlego';
if (drawing) {
self.circleLayer.removeLayer(marker);
@ -162,16 +168,16 @@ BR.CircleGoArea = L.Control.extend({
this.draw(false);
},
clear: function() {
clear: function () {
this.circleLayer.clearLayers();
},
getButton: function() {
getButton: function () {
return this.drawButton;
},
getCircle: function() {
var circle = this.circleLayer.getLayers().map(function(it) {
getCircle: function () {
var circle = this.circleLayer.getLayers().map(function (it) {
return it.getLatLng();
});
if (circle && circle.length) {
@ -181,15 +187,15 @@ BR.CircleGoArea = L.Control.extend({
}
},
toRadians: function(angleInDegrees) {
toRadians: function (angleInDegrees) {
return (angleInDegrees * Math.PI) / 180;
},
toDegrees: function(angleInRadians) {
toDegrees: function (angleInRadians) {
return (angleInRadians * 180) / Math.PI;
},
offset: function(c1, distance, bearing) {
offset: function (c1, distance, bearing) {
var lon1 = this.toRadians(c1[0]);
var lat1 = this.toRadians(c1[1]);
var dByR = distance / 6378137; // distance divided by 6378137 (radius of the earth) wgs84
@ -203,7 +209,7 @@ BR.CircleGoArea = L.Control.extend({
return [this.toDegrees(lon), this.toDegrees(lat)];
},
circleToPolygon: function(center, radius, numberOfSegments) {
circleToPolygon: function (center, radius, numberOfSegments) {
var n = numberOfSegments ? numberOfSegments : 32;
var inner = [];
@ -223,20 +229,20 @@ BR.CircleGoArea = L.Control.extend({
properties: {},
geometry: {
type: 'LineString',
coordinates: inner.slice(n / 2 - 1)
}
coordinates: inner.slice(n / 2 - 1),
},
},
{
type: 'Feature',
properties: {},
geometry: {
type: 'LineString',
coordinates: inner.slice(0, n / 2 + 1)
}
}
]
coordinates: inner.slice(0, n / 2 + 1),
},
},
],
};
}
},
});
BR.CircleGoArea.include(L.Evented.prototype);