Merge pull request #13293 from ahocevar/setstyle-reset-variables

Re-assign style variables on setStyle()
This commit is contained in:
Andreas Hocevar
2022-01-28 15:53:34 +01:00
committed by GitHub
2 changed files with 47 additions and 1 deletions

View File

@@ -456,10 +456,13 @@ class WebGLTileLayer extends BaseTileLayer {
/**
* Update the layer style. The `updateStyleVariables` function is a more efficient
* way to update layer rendering. In cases where the whole style needs to be updated,
* this method may be called instead.
* this method may be called instead. Note that calling this method will also replace
* any previously set variables, so the new style also needs to include new variables,
* if needed.
* @param {Style} style The new style.
*/
setStyle(style) {
this.styleVariables_ = style.variables || {};
this.style_ = style;
const parsedStyle = parseStyle(this.style_, this.getSourceBandCount_());
const renderer = this.getRenderer();