From c2b9222a464feb05464b1e918b31cdce85445942 Mon Sep 17 00:00:00 2001 From: jfboeve Date: Tue, 22 Oct 2024 11:11:49 +0200 Subject: [PATCH] fixed issue with effect keys not properly being created --- .../webgl/shaders/effects/LinearGradientEffect.ts | 7 +++++++ .../webgl/shaders/effects/RadialGradientEffect.ts | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.ts b/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.ts index fc08e7e8..d4f0504f 100644 --- a/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.ts +++ b/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.ts @@ -22,6 +22,7 @@ import { type DefaultEffectProps, ShaderEffect, type ShaderEffectUniforms, + type ShaderEffectValueMap, } from './ShaderEffect.js'; /** @@ -54,6 +55,12 @@ export class LinearGradientEffect extends ShaderEffect { override readonly name = 'linearGradient'; static override getEffectKey(props: LinearGradientEffectProps): string { + if ((props.colors as unknown as ShaderEffectValueMap).value as number[]) { + return `linearGradient${ + ((props.colors as unknown as ShaderEffectValueMap).value as number[]) + .length + }`; + } return `linearGradient${props.colors!.length}`; } diff --git a/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.ts b/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.ts index 5ee2eff6..5568080a 100644 --- a/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.ts +++ b/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.ts @@ -25,6 +25,7 @@ import { type DefaultEffectProps, ShaderEffect, type ShaderEffectUniforms, + type ShaderEffectValueMap, } from './ShaderEffect.js'; /** @@ -62,7 +63,13 @@ export class RadialGradientEffect extends ShaderEffect { override readonly name = 'radialGradient'; static override getEffectKey(props: RadialGradientEffectProps): string { - return `radialGradient${props.colors!.length}`; + if ((props.colors as unknown as ShaderEffectValueMap).value as number[]) { + return `linearGradient${ + ((props.colors as unknown as ShaderEffectValueMap).value as number[]) + .length + }`; + } + return `linearGradient${props.colors!.length}`; } static override resolveDefaults(