Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: ASCII Filter Deprecations #414

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/ascii/AsciiFilter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color, ColorSource, Filter, GlProgram, GpuProgram } from 'pixi.js';
import { Color, ColorSource, deprecation, Filter, GlProgram, GpuProgram } from 'pixi.js';
import { vertex, wgslVertex } from '../defaults';
import fragment from './ascii.frag';
import source from './ascii.wgsl';
Expand Down Expand Up @@ -53,8 +53,25 @@ export class AsciiFilter extends Filter

private _color!: Color;

constructor(options?: AsciiFilterOptions)
constructor(options?: AsciiFilterOptions);
/**
* @deprecated since 6.0.0
*
* @param {number} [size=8] - Size of the font
*/
constructor(size: number);
constructor(...args: [AsciiFilterOptions?] | [number])
{
let options = args[0] ?? {};

if (typeof options === 'number')
{
// eslint-disable-next-line max-len
deprecation('6.0.0', 'AsciiFilter constructor params are now options object. See params: { size, color, replaceColor }');

options = { size: options };
}

const replaceColor = options?.color && options.replaceColor !== false;

options = { ...AsciiFilter.DEFAULT_OPTIONS, ...options } as AsciiFilterOptions;
Expand Down
Loading