From 1a9282e1e8baa0ddac9092e8a102599408e6c3b6 Mon Sep 17 00:00:00 2001 From: Matt Karl Date: Sat, 3 Aug 2024 19:59:50 -0400 Subject: [PATCH] Fix: Allow allow saturation lightness via constructor --- src/hsl-adjustment/HslAdjustmentFilter.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hsl-adjustment/HslAdjustmentFilter.ts b/src/hsl-adjustment/HslAdjustmentFilter.ts index a1ac2a65d..cf59341e7 100644 --- a/src/hsl-adjustment/HslAdjustmentFilter.ts +++ b/src/hsl-adjustment/HslAdjustmentFilter.ts @@ -99,7 +99,7 @@ export class HslAdjustmentFilter extends Filter }); this.uniforms = this.resources.hslUniforms.uniforms; - this.hue = options.hue; + Object.assign(this, options); } /** @@ -110,34 +110,34 @@ export class HslAdjustmentFilter extends Filter set hue(value: number) { this._hue = value; - this.resources.hslUniforms.uniforms.uHsl[0] = value * (Math.PI / 180); + this.uniforms.uHsl[0] = value * (Math.PI / 180); } /** * The amount of lightness (-1 to 1) * @default 0 */ - get saturation(): number { return this.resources.hslUniforms.uniforms.uHsl[1]; } - set saturation(value: number) { this.resources.hslUniforms.uniforms.uHsl[1] = value; } + get saturation(): number { return this.uniforms.uHsl[1]; } + set saturation(value: number) { this.uniforms.uHsl[1] = value; } /** * The amount of lightness (-1 to 1) * @default 0 */ - get lightness(): number { return this.resources.hslUniforms.uniforms.uHsl[2]; } - set lightness(value: number) { this.resources.hslUniforms.uniforms.uHsl[2] = value; } + get lightness(): number { return this.uniforms.uHsl[2]; } + set lightness(value: number) { this.uniforms.uHsl[2] = value; } /** * Whether to colorize the image * @default false */ - get colorize(): boolean { return this.resources.hslUniforms.uniforms.uColorize === 1; } - set colorize(value: boolean) { this.resources.hslUniforms.uniforms.uColorize = value ? 1 : 0; } + get colorize(): boolean { return this.uniforms.uColorize === 1; } + set colorize(value: boolean) { this.uniforms.uColorize = value ? 1 : 0; } /** * The amount of alpha (0 to 1) * @default 1 */ - get alpha(): number { return this.resources.hslUniforms.uniforms.uAlpha; } - set alpha(value: number) { this.resources.hslUniforms.uniforms.uAlpha = value; } + get alpha(): number { return this.uniforms.uAlpha; } + set alpha(value: number) { this.uniforms.uAlpha = value; } }