Re-assign variables on setStyle()

This commit is contained in:
Andreas Hocevar
2022-01-28 07:22:07 +01:00
parent a1454ce18f
commit 11e12ef94e
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();