From f17fd8a6d39a3926173128a0f16203d4ebaa2bb9 Mon Sep 17 00:00:00 2001 From: Serge Date: Mon, 15 Jul 2024 12:24:25 +0200 Subject: [PATCH] fix(ngx-splitter): fix wrong value on event --- projects/splitter/src/splitter.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/splitter/src/splitter.component.ts b/projects/splitter/src/splitter.component.ts index bd97e5d7..90c94bb0 100644 --- a/projects/splitter/src/splitter.component.ts +++ b/projects/splitter/src/splitter.component.ts @@ -150,9 +150,9 @@ export class SplitterComponent extends Destroy { const diffInPixels = startPos - pos; const areaSizeInPixelsA = startSizeInPixelsA - diffInPixels; const areaSizeInPixelsB = startSizeInPixelsB + diffInPixels; - areaA.size = Math.min(100, Math.max(0, 100 * areaSizeInPixelsA / containerSizeInPixels)); + const areaSizeInPercentA = areaA.size = Math.min(100, Math.max(0, 100 * areaSizeInPixelsA / containerSizeInPixels)); areaB.size = Math.min(100, Math.max(0, 100 * areaSizeInPixelsB / containerSizeInPixels)); - const percentWithTwoDigits = Math.round(areaA.size * 100) / 100; + const percentWithTwoDigits = Math.round(areaSizeInPercentA * 100) / 100; this.dragProgress.emit(percentWithTwoDigits); }), takeUntil(stopDragging$)