Skip to content

Commit 1a9282e

Browse files
committed
Fix: Allow allow saturation lightness via constructor
1 parent e1821f1 commit 1a9282e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/hsl-adjustment/HslAdjustmentFilter.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class HslAdjustmentFilter extends Filter
9999
});
100100

101101
this.uniforms = this.resources.hslUniforms.uniforms;
102-
this.hue = options.hue;
102+
Object.assign(this, options);
103103
}
104104

105105
/**
@@ -110,34 +110,34 @@ export class HslAdjustmentFilter extends Filter
110110
set hue(value: number)
111111
{
112112
this._hue = value;
113-
this.resources.hslUniforms.uniforms.uHsl[0] = value * (Math.PI / 180);
113+
this.uniforms.uHsl[0] = value * (Math.PI / 180);
114114
}
115115

116116
/**
117117
* The amount of lightness (-1 to 1)
118118
* @default 0
119119
*/
120-
get saturation(): number { return this.resources.hslUniforms.uniforms.uHsl[1]; }
121-
set saturation(value: number) { this.resources.hslUniforms.uniforms.uHsl[1] = value; }
120+
get saturation(): number { return this.uniforms.uHsl[1]; }
121+
set saturation(value: number) { this.uniforms.uHsl[1] = value; }
122122

123123
/**
124124
* The amount of lightness (-1 to 1)
125125
* @default 0
126126
*/
127-
get lightness(): number { return this.resources.hslUniforms.uniforms.uHsl[2]; }
128-
set lightness(value: number) { this.resources.hslUniforms.uniforms.uHsl[2] = value; }
127+
get lightness(): number { return this.uniforms.uHsl[2]; }
128+
set lightness(value: number) { this.uniforms.uHsl[2] = value; }
129129

130130
/**
131131
* Whether to colorize the image
132132
* @default false
133133
*/
134-
get colorize(): boolean { return this.resources.hslUniforms.uniforms.uColorize === 1; }
135-
set colorize(value: boolean) { this.resources.hslUniforms.uniforms.uColorize = value ? 1 : 0; }
134+
get colorize(): boolean { return this.uniforms.uColorize === 1; }
135+
set colorize(value: boolean) { this.uniforms.uColorize = value ? 1 : 0; }
136136

137137
/**
138138
* The amount of alpha (0 to 1)
139139
* @default 1
140140
*/
141-
get alpha(): number { return this.resources.hslUniforms.uniforms.uAlpha; }
142-
set alpha(value: number) { this.resources.hslUniforms.uniforms.uAlpha = value; }
141+
get alpha(): number { return this.uniforms.uAlpha; }
142+
set alpha(value: number) { this.uniforms.uAlpha = value; }
143143
}

0 commit comments

Comments
 (0)