From 8dae33ac13196ee1fe581c4674cb220fb1163c16 Mon Sep 17 00:00:00 2001 From: Mert Sincan Date: Thu, 28 Nov 2024 09:52:40 +0000 Subject: [PATCH] Refactor #16793 - Splitter --- packages/primeng/src/splitter/splitter.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/primeng/src/splitter/splitter.ts b/packages/primeng/src/splitter/splitter.ts index aa7fd7b68b..c401857e8c 100755 --- a/packages/primeng/src/splitter/splitter.ts +++ b/packages/primeng/src/splitter/splitter.ts @@ -1,6 +1,6 @@ import { CommonModule, isPlatformBrowser } from '@angular/common'; import { ChangeDetectionStrategy, Component, ContentChildren, ElementRef, EventEmitter, inject, Input, NgModule, numberAttribute, Output, QueryList, ViewChild, ViewEncapsulation } from '@angular/core'; -import { addClass, getHeight, getOuterHeight, getOuterWidth, getWidth, hasClass, removeClass } from '@primeuix/utils'; +import { addClass, getHeight, getOuterHeight, getOuterWidth, getWidth, hasClass, isRTL, removeClass } from '@primeuix/utils'; import { SharedModule } from 'primeng/api'; import { BaseComponent } from 'primeng/basecomponent'; import { Nullable, VoidListener } from 'primeng/ts-helpers'; @@ -262,8 +262,15 @@ export class Splitter extends BaseComponent { newNextPanelSize = (100 * (this.nextPanelSize + step)) / this.size; } } else { - if (this.horizontal()) newPos = (event.pageX * 100) / this.size - (this.startPos * 100) / this.size; - else newPos = (event.pageY * 100) / this.size - (this.startPos * 100) / this.size; + if (this.horizontal) { + if (isRTL(this.el.nativeElement)) { + newPos = ((this.startPos - event.pageX) * 100) / this.size; + } else { + newPos = ((event.pageX - this.startPos) * 100) / this.size; + } + } else { + newPos = ((event.pageY - this.startPos) * 100) / this.size; + } newPrevPanelSize = (this.prevPanelSize as number) + newPos; newNextPanelSize = (this.nextPanelSize as number) - newPos;