aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.js b/main.js
index 1c9fbab..b1d466f 100644
--- a/main.js
+++ b/main.js
@@ -3440,8 +3440,11 @@ const infoMetadataAccordions = [];
const n = Math.max(...indices.map(([i]) => i));
const palette = new Array(n+1).fill(nodata);
indices.forEach(([i,l]) => palette[i] = styles[l] ?? nodata);
- /* XXX unfortunately calling .setStyle() makes the layer blink */
- lyr.setStyle({ color: ['palette', ['band', 1], palette ] });
+ /* XXX unfortunately calling .setStyle() makes the layer blink; using style variabse would
+ * be nicer, but `['palette', ['band', 1], [['var', 'val1'], …]]` fails as each palette index
+ * needs to be a color literal, even when `['var', 'val1']` evaluates to such, cf.
+ * https://github.com/openlayers/openlayers/blob/v10.6.0/src/ol/expr/expression.js#L976 */
+ lyr.setStyle({ color: ['palette', ['band', 1], palette] });
}
});
Object.entries(LAYERS).forEach(function([k,v]) {