Skip to content

Commit 3d4f7c3

Browse files
authored
Chore: OutlineFilter deprecate non-options constructor (#430)
* Chore: Outline Filter Deprecations * Cleanup --------- Co-authored-by: Baz Utsahajit <[email protected]>
1 parent e8fe729 commit 3d4f7c3

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/outline/OutlineFilter.ts

+29-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Color, Filter, GlProgram, GpuProgram } from 'pixi.js';
1+
import { Color, deprecation, Filter, GlProgram, GpuProgram } from 'pixi.js';
22
import { vertex, wgslVertex } from '../defaults';
33
import fragment from './outline.frag';
44
import source from './outline.wgsl';
@@ -77,8 +77,35 @@ export class OutlineFilter extends Filter
7777
private _quality!: number;
7878
private _color!: Color;
7979

80-
constructor(options?: OutlineFilterOptions)
80+
constructor(options?: OutlineFilterOptions);
81+
/**
82+
* @deprecated since 6.0.0
83+
*
84+
* @param {number} [thickness=1] - The tickness of the outline. Make it 2 times more for resolution 2
85+
* @param {number} [color=0x000000] - The color of the outline.
86+
* @param {number} [quality=0.1] - The quality of the outline from `0` to `1`, using a higher quality
87+
* setting will result in slower performance and more accuracy.
88+
* @param {number} [alpha=1.0] - The alpha of the outline.
89+
* @param {boolean} [knockout=false] - Only render outline, not the contents.
90+
*/
91+
constructor(thickness?: number, color?: number, quality?: number, alpha?: number, knockout?: boolean);
92+
constructor(...args: [OutlineFilterOptions?] | [number?, number?, number?, number?, boolean?])
8193
{
94+
let options = args[0] ?? {};
95+
96+
if (typeof options === 'number')
97+
{
98+
// eslint-disable-next-line max-len
99+
deprecation('6.0.0', 'OutlineFilter constructor params are now options object. See params: { thickness, color, quality, alpha, knockout }');
100+
101+
options = { thickness: options };
102+
103+
if (args[1] !== undefined) options.color = args[1];
104+
if (args[2] !== undefined) options.quality = args[2];
105+
if (args[3] !== undefined) options.alpha = args[3];
106+
if (args[4] !== undefined) options.knockout = args[4];
107+
}
108+
82109
options = { ...OutlineFilter.DEFAULT_OPTIONS, ...options };
83110

84111
const quality = options.quality ?? 0.1;

0 commit comments

Comments
 (0)