From 81ec7122ea8394f9aca99787b42d51e1287311bd Mon Sep 17 00:00:00 2001 From: Phan Huy Tran Date: Wed, 4 Jun 2025 12:31:05 +0200 Subject: [PATCH 1/2] fix: display real number --- .../animated-number/animated-number.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/feature/game/blackjack/components/animated-number/animated-number.component.ts b/frontend/src/app/feature/game/blackjack/components/animated-number/animated-number.component.ts index 6e61c0e..c36a248 100644 --- a/frontend/src/app/feature/game/blackjack/components/animated-number/animated-number.component.ts +++ b/frontend/src/app/feature/game/blackjack/components/animated-number/animated-number.component.ts @@ -61,6 +61,9 @@ export class AnimatedNumberComponent implements OnChanges, AfterViewInit { this.countUp = new CountUp(this.numberElement.nativeElement, this.value, { startVal: this.previousValue, duration: this.duration, + decimalPlaces: 2, + useEasing: true, + useGrouping: false, // We'll handle grouping in the formatting function easingFn: (t, b, c, d) => { if (this.ease === 'power1.out') { return c * (1 - Math.pow(1 - t / d, 1)) + b; @@ -68,12 +71,14 @@ export class AnimatedNumberComponent implements OnChanges, AfterViewInit { return c * (t / d) + b; }, formattingFn: (value) => { + // Ensure we preserve the exact decimal value during animation + const numericValue = typeof value === 'string' ? parseFloat(value) : value; const formatted = new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR', minimumFractionDigits: 2, maximumFractionDigits: 2, - }).format(value); + }).format(numericValue); this.formattedValue = formatted; return formatted; }, From e35a30a606a4326e965677f9c8f9c2275cf73df6 Mon Sep 17 00:00:00 2001 From: Phan Huy Tran Date: Wed, 4 Jun 2025 12:32:44 +0200 Subject: [PATCH 2/2] refactor: remove unnecessary code --- .../components/animated-number/animated-number.component.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/feature/game/blackjack/components/animated-number/animated-number.component.ts b/frontend/src/app/feature/game/blackjack/components/animated-number/animated-number.component.ts index c36a248..9b07eee 100644 --- a/frontend/src/app/feature/game/blackjack/components/animated-number/animated-number.component.ts +++ b/frontend/src/app/feature/game/blackjack/components/animated-number/animated-number.component.ts @@ -63,7 +63,7 @@ export class AnimatedNumberComponent implements OnChanges, AfterViewInit { duration: this.duration, decimalPlaces: 2, useEasing: true, - useGrouping: false, // We'll handle grouping in the formatting function + useGrouping: false, easingFn: (t, b, c, d) => { if (this.ease === 'power1.out') { return c * (1 - Math.pow(1 - t / d, 1)) + b; @@ -71,14 +71,12 @@ export class AnimatedNumberComponent implements OnChanges, AfterViewInit { return c * (t / d) + b; }, formattingFn: (value) => { - // Ensure we preserve the exact decimal value during animation - const numericValue = typeof value === 'string' ? parseFloat(value) : value; const formatted = new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR', minimumFractionDigits: 2, maximumFractionDigits: 2, - }).format(numericValue); + }).format(value); this.formattedValue = formatted; return formatted; },