diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2025-06-17 20:09:55 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2025-06-17 20:23:33 +0200 |
commit | a34b82f52be29ee9935119e0954a00d43a9e72ae (patch) | |
tree | 049071681be85e399302953b8cfb237e3371f87e | |
parent | 18e454449748dc595ceb8fb8d1ece727453aafdf (diff) |
Add comment.
-rw-r--r-- | main.js | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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]) { |