Be more explicit on changed fields when updating choropleth form
The postUpdate method of the Choropleth layer is called after any form field change, even if this field is not in the dedicated choropleth helper. So the previous check was too broad, and it would try to fetch the breaks input value on any form helper, which would fail if someone change any "non choropleth" property (like the colour)
This commit is contained in:
parent
5f744848ac
commit
936bbb9464
1 changed files with 9 additions and 4 deletions
|
@ -235,13 +235,18 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
|
|||
},
|
||||
|
||||
postUpdate: function (e) {
|
||||
if (e.helper.field === 'options.choropleth.breaks') {
|
||||
const field = e.helper.field,
|
||||
builder = e.helper.builder
|
||||
// If user touches the breaks, then force manual mode
|
||||
if (field === 'options.choropleth.breaks') {
|
||||
this.datalayer.options.choropleth.mode = 'manual'
|
||||
e.helper.builder.helpers['options.choropleth.mode'].fetch()
|
||||
builder.helpers['options.choropleth.mode'].fetch()
|
||||
}
|
||||
this.computeBreaks()
|
||||
if (e.helper.field !== 'options.choropleth.breaks') {
|
||||
e.helper.builder.helpers['options.choropleth.breaks'].fetch()
|
||||
// If user changes the mode or the number of classes,
|
||||
// then update the breaks input value
|
||||
if (field === 'options.choropleth.mode' || field === 'options.choropleth.classes') {
|
||||
builder.helpers['options.choropleth.breaks'].fetch()
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue