mirror of
https://github.com/umap-project/umap.git
synced 2025-05-06 06:21:49 +02:00
Allow syncing of layers
This commit is contained in:
parent
07b1e237cd
commit
1740c45837
3 changed files with 8 additions and 5 deletions
|
@ -53,7 +53,8 @@ export class DatalayerUpdater extends BaseUpdater {
|
||||||
const datalayer = this.getLayerFromID(metadata.id)
|
const datalayer = this.getLayerFromID(metadata.id)
|
||||||
console.log(datalayer, key, value)
|
console.log(datalayer, key, value)
|
||||||
this.updateObjectValue(datalayer, key, value)
|
this.updateObjectValue(datalayer, key, value)
|
||||||
datalayer.renderProperties([key])
|
const property = key.replace("options.", "")
|
||||||
|
datalayer.renderProperties([property])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ L.U.DataRendererMixin = {
|
||||||
*
|
*
|
||||||
* @param list properties : properties that have been updated.
|
* @param list properties : properties that have been updated.
|
||||||
*/
|
*/
|
||||||
renderProperties: function (properties, builder) {
|
renderProperties: function (properties) {
|
||||||
let renderers = new Set()
|
let renderers = new Set()
|
||||||
for (const prop of properties) {
|
for (const prop of properties) {
|
||||||
const propRenderers = this.propertiesRenderers[prop]
|
const propRenderers = this.propertiesRenderers[prop]
|
||||||
|
@ -36,7 +36,9 @@ L.U.DataRendererMixin = {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const renderer of renderers) {
|
for (const renderer of renderers) {
|
||||||
this[renderer](properties, builder)
|
if (renderer in this) {
|
||||||
|
this[renderer](properties)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -257,13 +257,13 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
|
||||||
// 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'
|
||||||
builder.helpers['options.choropleth.mode'].fetch()
|
if (builder) builder.helpers['options.choropleth.mode'].fetch()
|
||||||
}
|
}
|
||||||
this.computeBreaks()
|
this.computeBreaks()
|
||||||
// If user changes the mode or the number of classes,
|
// If user changes the mode or the number of classes,
|
||||||
// then update the breaks input value
|
// then update the breaks input value
|
||||||
if (field === 'options.choropleth.mode' || field === 'options.choropleth.classes') {
|
if (field === 'options.choropleth.mode' || field === 'options.choropleth.classes') {
|
||||||
builder.helpers['options.choropleth.breaks'].fetch()
|
if (builder) builder.helpers['options.choropleth.breaks'].fetch()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue