Skip to content

Commit 6fa5c53

Browse files
authored
Splitter: prevent cursor misalignment after runtime orientation change (T1327400) (#33405)
1 parent b8120ab commit 6fa5c53

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

packages/devextreme/js/__internal/ui/splitter/splitter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,11 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
492492
const leftItemIndex = this._getIndexByItem(leftItemData);
493493
this._activeResizeHandleIndex = leftItemIndex;
494494

495+
const { orientation: currentOrientation } = this.option();
496+
495497
this._currentOnePxRatio = convertSizeToRatio(
496498
1,
497-
getElementSize($(this.element()), orientation),
499+
getElementSize($(this.element()), currentOrientation),
498500
this._getResizeHandlesSize(),
499501
);
500502

packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,6 +2364,20 @@ QUnit.module('Resizing', moduleConfig, () => {
23642364
this.assertLayout(['75', '25']);
23652365
});
23662366

2367+
QUnit.test('resize should use current orientation for ratio calculation after orientation runtime change (T1327400)', function(assert) {
2368+
this.reinit({
2369+
width: 408, height: 208,
2370+
items: [{ }, { }],
2371+
});
2372+
2373+
this.instance.option('orientation', 'vertical');
2374+
2375+
const pointer = pointerMock(this.getResizeHandles().eq(0));
2376+
pointer.start().dragStart().drag(0, 50).dragEnd();
2377+
2378+
this.assertLayout(['75', '25']);
2379+
});
2380+
23672381
QUnit.test('drag resize should work after setting pane size to 0 programmatically', function(assert) {
23682382
this.reinit({
23692383
width: 208, height: 208,

0 commit comments

Comments
 (0)