From 70ee68c649d6cc3da86b6aae97d0f08546d1f31c Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Tue, 18 Jan 2022 20:54:11 +0000 Subject: [PATCH] Add crossOrigin option Co-Authored-By: Andreas Hocevar --- src/ol/style/literal.js | 1 + src/ol/webgl/ShaderBuilder.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/ol/style/literal.js b/src/ol/style/literal.js index 3fc310126a..6f73f338aa 100644 --- a/src/ol/style/literal.js +++ b/src/ol/style/literal.js @@ -32,6 +32,7 @@ export const SymbolType = { * @property {ExpressionValue|Array} size Size, mandatory. * @property {SymbolType} symbolType Symbol type to use, either a regular shape or an image. * @property {string} [src] Path to the image to be used for the symbol. Only required with `symbolType: 'image'`. + * @property {string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loading `src`. * @property {import("../color.js").Color|Array|string} [color='#FFFFFF'] Color used for the representation (either fill, line or symbol). * @property {ExpressionValue} [opacity=1] Opacity. * @property {ExpressionValue} [rotation=0] Symbol rotation in radians. diff --git a/src/ol/webgl/ShaderBuilder.js b/src/ol/webgl/ShaderBuilder.js index 5c9ae52b65..60913ac8f0 100644 --- a/src/ol/webgl/ShaderBuilder.js +++ b/src/ol/webgl/ShaderBuilder.js @@ -548,6 +548,8 @@ export function parseLiteralStyle(style) { if (symbStyle.symbolType === 'image' && symbStyle.src) { const texture = new Image(); + texture.crossOrigin = + symbStyle.crossOrigin === undefined ? 'anonymous' : symbStyle.crossOrigin; texture.src = symbStyle.src; builder .addUniform('sampler2D u_texture')