Run prettier on umap.layer.js
This commit is contained in:
parent
fc2b7e5d4b
commit
34e0461ca8
1 changed files with 27 additions and 10 deletions
|
@ -178,7 +178,10 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
|
||||||
if (mode === 'manual') {
|
if (mode === 'manual') {
|
||||||
const manualBreaks = this.datalayer.options.choropleth.breaks
|
const manualBreaks = this.datalayer.options.choropleth.breaks
|
||||||
if (manualBreaks) {
|
if (manualBreaks) {
|
||||||
breaks = manualBreaks.split(",").map(b => +b).filter(b => !isNaN(b))
|
breaks = manualBreaks
|
||||||
|
.split(',')
|
||||||
|
.map((b) => +b)
|
||||||
|
.filter((b) => !isNaN(b))
|
||||||
}
|
}
|
||||||
} else if (mode === 'equidistant') {
|
} else if (mode === 'equidistant') {
|
||||||
breaks = ss.equalIntervalBreaks(values, classes)
|
breaks = ss.equalIntervalBreaks(values, classes)
|
||||||
|
@ -192,7 +195,9 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
|
||||||
breaks.push(ss.max(values)) // Needed for computing the legend
|
breaks.push(ss.max(values)) // Needed for computing the legend
|
||||||
}
|
}
|
||||||
this.options.breaks = breaks || []
|
this.options.breaks = breaks || []
|
||||||
this.datalayer.options.choropleth.breaks = this.options.breaks.map(b => +b.toFixed(2)).join(',')
|
this.datalayer.options.choropleth.breaks = this.options.breaks
|
||||||
|
.map((b) => +b.toFixed(2))
|
||||||
|
.join(',')
|
||||||
const fillColor = this.datalayer.getOption('fillColor') || this.defaults.fillColor
|
const fillColor = this.datalayer.getOption('fillColor') || this.defaults.fillColor
|
||||||
let colorScheme = this.datalayer.options.choropleth.brewer
|
let colorScheme = this.datalayer.options.choropleth.brewer
|
||||||
if (!colorbrewer[colorScheme]) colorScheme = 'Blues'
|
if (!colorbrewer[colorScheme]) colorScheme = 'Blues'
|
||||||
|
@ -211,7 +216,9 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getOption: function (option, feature) {
|
getOption: function (option, feature) {
|
||||||
if (feature && option === feature.staticOptions.mainColor) return this.getColor(feature)
|
if (feature && option === feature.staticOptions.mainColor) {
|
||||||
|
return this.getColor(feature)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addLayer: function (layer) {
|
addLayer: function (layer) {
|
||||||
|
@ -230,11 +237,11 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
|
||||||
postUpdate: function (e) {
|
postUpdate: function (e) {
|
||||||
if (e.helper.field === 'options.choropleth.breaks') {
|
if (e.helper.field === 'options.choropleth.breaks') {
|
||||||
this.datalayer.options.choropleth.mode = 'manual'
|
this.datalayer.options.choropleth.mode = 'manual'
|
||||||
e.helper.builder.helpers["options.choropleth.mode"].fetch()
|
e.helper.builder.helpers['options.choropleth.mode'].fetch()
|
||||||
}
|
}
|
||||||
this.computeBreaks()
|
this.computeBreaks()
|
||||||
if (e.helper.field !== 'options.choropleth.breaks') {
|
if (e.helper.field !== 'options.choropleth.breaks') {
|
||||||
e.helper.builder.helpers["options.choropleth.breaks"].fetch()
|
e.helper.builder.helpers['options.choropleth.breaks'].fetch()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -276,7 +283,9 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
|
||||||
{
|
{
|
||||||
handler: 'BlurInput',
|
handler: 'BlurInput',
|
||||||
label: L._('Choropleth breakpoints'),
|
label: L._('Choropleth breakpoints'),
|
||||||
helpText: L._('Comma separated list of numbers, including min and max values.'),
|
helpText: L._(
|
||||||
|
'Comma separated list of numbers, including min and max values.'
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -601,7 +610,13 @@ L.U.DataLayer = L.Evented.extend({
|
||||||
|
|
||||||
resetLayer: function (force) {
|
resetLayer: function (force) {
|
||||||
// Only reset if type is defined (undefined is the default) and different from current type
|
// Only reset if type is defined (undefined is the default) and different from current type
|
||||||
if (this.layer && (!this.options.type || this.options.type === this.layer._type) && !force) return
|
if (
|
||||||
|
this.layer &&
|
||||||
|
(!this.options.type || this.options.type === this.layer._type) &&
|
||||||
|
!force
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const visible = this.isVisible()
|
const visible = this.isVisible()
|
||||||
if (this.layer) this.layer.clearLayers()
|
if (this.layer) this.layer.clearLayers()
|
||||||
// delete this.layer?
|
// delete this.layer?
|
||||||
|
@ -641,7 +656,9 @@ L.U.DataLayer = L.Evented.extend({
|
||||||
// So do not let all options to be reset
|
// So do not let all options to be reset
|
||||||
// Fix is a proper migration so all datalayers settings are
|
// Fix is a proper migration so all datalayers settings are
|
||||||
// in DB, and we remove it from geojson flat files.
|
// in DB, and we remove it from geojson flat files.
|
||||||
if (geojson._umap_options) geojson._umap_options.editMode = this.options.editMode
|
if (geojson._umap_options) {
|
||||||
|
geojson._umap_options.editMode = this.options.editMode
|
||||||
|
}
|
||||||
// In case of maps pre 1.0 still around
|
// In case of maps pre 1.0 still around
|
||||||
if (geojson._storage) geojson._storage.editMode = this.options.editMode
|
if (geojson._storage) geojson._storage.editMode = this.options.editMode
|
||||||
this.fromUmapGeoJSON(geojson)
|
this.fromUmapGeoJSON(geojson)
|
||||||
|
|
Loading…
Reference in a new issue