From 181bdcd55e80f4a88d4360771f5f73db84469b07 Mon Sep 17 00:00:00 2001 From: Theophyl Hoguet Date: Fri, 17 Mar 2023 03:09:10 +0100 Subject: [PATCH] clone + remove update field --- frontend/src/filter.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/filter.ts b/frontend/src/filter.ts index 7782a8c..8a64df3 100644 --- a/frontend/src/filter.ts +++ b/frontend/src/filter.ts @@ -5,11 +5,11 @@ export class Arg { step: number value: number | undefined - constructor(name: string, min: number, max: number, step: number = 1) { + constructor(name: string, min: number, max: number, step: number = 1, value: number | undefined = undefined) { this.name = name this.min = min this.max = max - this.value = undefined + this.value = value this.step = step } @@ -19,7 +19,6 @@ export class Filter { name: string path: string args: Arg[] - updated: boolean = false constructor(name: string, path: string, args: Arg[]) { this.name = name @@ -33,4 +32,8 @@ export class Filter { public getArgs(): string { return '&' + this.args.map((arg) => arg.name + "=" + arg.value).join("&"); } + + public clone(): Filter { + return new Filter(this.name, this.path, this.args.map((arg) => new Arg(arg.name, arg.min, arg.max, arg.step, arg.value))) + } } \ No newline at end of file