Add crossOrigin option
Co-Authored-By: Andreas Hocevar <andreas.hocevar@gmail.com>
This commit is contained in:
@@ -32,6 +32,7 @@ export const SymbolType = {
|
||||
* @property {ExpressionValue|Array<ExpressionValue, ExpressionValue>} 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<ExpressionValue>|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.
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user