Add updateStyleVariables method to WebGLPoints layer

This commit is contained in:
Andreas Hocevar
2022-01-28 11:11:46 +01:00
parent 5cfb634d89
commit 770fcc870b
2 changed files with 77 additions and 0 deletions

View File

@@ -87,6 +87,12 @@ class WebGLPointsLayer extends Layer {
*/
this.parseResult_ = parseLiteralStyle(options.style);
/**
* @type {Object<string, (string|number)>}
* @private
*/
this.styleVariables_ = options.style.variables || {};
/**
* @private
* @type {boolean}
@@ -108,6 +114,15 @@ class WebGLPointsLayer extends Layer {
attributes: this.parseResult_.attributes,
});
}
/**
* Update any variables used by the layer style and trigger a re-render.
* @param {Object<string, number>} variables Variables to update.
*/
updateStyleVariables(variables) {
assign(this.styleVariables_, variables);
this.changed();
}
}
export default WebGLPointsLayer;