Add abstract getter for default parameters.

This commit is contained in:
Bauke 2022-03-07 22:08:28 +01:00
parent 6e1c684ba4
commit 243e53c413
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
6 changed files with 22 additions and 0 deletions

View File

@ -1,4 +1,6 @@
export abstract class BaseOperation<P> {
public abstract get default(): P;
public parameters: P;
/**

View File

@ -17,6 +17,10 @@ export class Crop extends BaseOperation<CropParameters> {
y: 0,
};
public get default() {
return Crop.default;
}
public appendCrop = false;
public name = 'gegl:crop';

View File

@ -3,6 +3,10 @@ import {BaseOperation} from './base.js';
export type GenericParameters = Record<string, number | string>;
export class Generic extends BaseOperation<GenericParameters> {
public get default() {
return {};
}
public appendCrop: boolean;
public name: string;

View File

@ -33,6 +33,10 @@ export class Mirrors extends BaseOperation<MirrorsParameters> {
warp: true,
};
public get default() {
return Mirrors.default;
}
public appendCrop = false;
public name = 'gegl:mirrors';

View File

@ -45,6 +45,10 @@ export class Newsprint extends BaseOperation<NewsprintParameters> {
turbulence: 0,
};
public get default() {
return Newsprint.default;
}
public appendCrop = false;
public name = 'gegl:newsprint';

View File

@ -13,6 +13,10 @@ export class SimplexNoise extends BaseOperation<SimplexNoiseParameters> {
seed: 1,
};
public get default() {
return SimplexNoise.default;
}
public appendCrop = true;
public name = 'gegl:simplex-noise';