Rename Layer.postUpdate to Layer.onEdit and pass explicit params
This commit is contained in:
parent
936bbb9464
commit
7f4d5b270b
1 changed files with 11 additions and 12 deletions
|
@ -9,7 +9,7 @@ L.U.Layer = {
|
||||||
return []
|
return []
|
||||||
},
|
},
|
||||||
|
|
||||||
postUpdate: function () {},
|
onEdit: function () {},
|
||||||
|
|
||||||
hasDataVisible: function () {
|
hasDataVisible: function () {
|
||||||
return !!Object.keys(this._layers).length
|
return !!Object.keys(this._layers).length
|
||||||
|
@ -104,13 +104,13 @@ L.U.Layer.Cluster = L.MarkerClusterGroup.extend({
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
postUpdate: function (e) {
|
onEdit: function (field, builder) {
|
||||||
if (e.helper.field === 'options.cluster.radius') {
|
if (field === 'options.cluster.radius') {
|
||||||
// No way to reset radius of an already instanciated MarkerClusterGroup...
|
// No way to reset radius of an already instanciated MarkerClusterGroup...
|
||||||
this.datalayer.resetLayer(true)
|
this.datalayer.resetLayer(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (e.helper.field === 'options.color') {
|
if (field === 'options.color') {
|
||||||
this.options.polygonOptions.color = this.datalayer.getColor()
|
this.options.polygonOptions.color = this.datalayer.getColor()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -234,9 +234,7 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
|
||||||
L.FeatureGroup.prototype.onAdd.call(this, map)
|
L.FeatureGroup.prototype.onAdd.call(this, map)
|
||||||
},
|
},
|
||||||
|
|
||||||
postUpdate: function (e) {
|
onEdit: function (field, builder) {
|
||||||
const field = e.helper.field,
|
|
||||||
builder = e.helper.builder
|
|
||||||
// If user touches the breaks, then force manual mode
|
// If user touches the breaks, then force manual mode
|
||||||
if (field === 'options.choropleth.breaks') {
|
if (field === 'options.choropleth.breaks') {
|
||||||
this.datalayer.options.choropleth.mode = 'manual'
|
this.datalayer.options.choropleth.mode = 'manual'
|
||||||
|
@ -387,12 +385,12 @@ L.U.Layer.Heat = L.HeatLayer.extend({
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
postUpdate: function (e) {
|
onEdit: function (field, builder) {
|
||||||
if (e.helper.field === 'options.heat.intensityProperty') {
|
if (field === 'options.heat.intensityProperty') {
|
||||||
this.datalayer.resetLayer(true) // We need to repopulate the latlngs
|
this.datalayer.resetLayer(true) // We need to repopulate the latlngs
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (e.helper.field === 'options.heat.radius') {
|
if (field === 'options.heat.radius') {
|
||||||
this.options.radius = this.datalayer.options.heat.radius
|
this.options.radius = this.datalayer.options.heat.radius
|
||||||
}
|
}
|
||||||
this._updateOptions()
|
this._updateOptions()
|
||||||
|
@ -1204,11 +1202,12 @@ L.U.DataLayer = L.Evented.extend({
|
||||||
]
|
]
|
||||||
|
|
||||||
const redrawCallback = function (e) {
|
const redrawCallback = function (e) {
|
||||||
|
const field = e.helper.field,
|
||||||
|
builder = e.helper.builder
|
||||||
this.hide()
|
this.hide()
|
||||||
this.layer.postUpdate(e)
|
this.layer.onEdit(field, builder)
|
||||||
this.show()
|
this.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
builder = new L.U.FormBuilder(this, shapeOptions, {
|
builder = new L.U.FormBuilder(this, shapeOptions, {
|
||||||
id: 'datalayer-advanced-properties',
|
id: 'datalayer-advanced-properties',
|
||||||
callback: redrawCallback,
|
callback: redrawCallback,
|
||||||
|
|
Loading…
Reference in a new issue