Skip to content

Commit

Permalink
Chore: DotFilter deprecate non-options constructor (#421)
Browse files Browse the repository at this point in the history
* Chore: Dot Filter Deprecations

* Cleanup

---------

Co-authored-by: Baz Utsahajit <[email protected]>
  • Loading branch information
bbazukun123 and bbazukun123 authored Feb 14, 2024
1 parent 2029494 commit 6fcc311
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/dot/DotFilter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Filter, GlProgram, GpuProgram } from 'pixi.js';
import { deprecation, Filter, GlProgram, GpuProgram } from 'pixi.js';
import { vertex, wgslVertex } from '../defaults';
import fragment from './dot.frag';
import source from './dot.wgsl';
Expand Down Expand Up @@ -48,8 +48,30 @@ export class DotFilter extends Filter
grayscale: true
};

constructor(options?: DotFilterOptions)
constructor(options?: DotFilterOptions);
/**
* @deprecated since 6.0.0
*
* @param {number} [scale=1] - The scale of the effect.
* @param {number} [angle=5] - The radius of the effect.
* @param {boolean} [grayscale=true] - Render as grayscale.
*/
constructor(scale?: number, angle?: number, grayscale?: boolean);
constructor(...args: [DotFilterOptions?] | [number?, number?, boolean?])
{
let options = args[0] ?? {};

if (typeof options === 'number')
{
// eslint-disable-next-line max-len
deprecation('6.0.0', 'DotFilter constructor params are now options object. See params: { scale, angle, grayscale }');

options = { scale: options };

if (args[1] !== undefined) options.angle = args[1];
if (args[2] !== undefined) options.grayscale = args[2];
}

options = { ...DotFilter.DEFAULT_OPTIONS, ...options };

const dotUniforms = {
Expand Down

0 comments on commit 6fcc311

Please sign in to comment.