Skip to content

Commit d43e834

Browse files
authored
Splitter: prevent cursor misalignment after runtime orientation change (T1327400) (#33403)
1 parent 585669d commit d43e834

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
@@ -556,9 +556,11 @@ class Splitter extends CollectionWidgetLiveUpdate<Properties> {
556556
const leftItemIndex = this._getIndexByItem(leftItemData);
557557
this._activeResizeHandleIndex = leftItemIndex;
558558

559+
const { orientation: currentOrientation } = this.option();
560+
559561
this._currentOnePxRatio = convertSizeToRatio(
560562
1,
561-
getElementSize($(this.element()), orientation),
563+
getElementSize($(this.element()), currentOrientation),
562564
this._getResizeHandlesSize(),
563565
);
564566

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

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

3096+
QUnit.test('resize should use current orientation for ratio calculation after orientation runtime change (T1327400)', function(assert) {
3097+
this.reinit({
3098+
width: 408, height: 208,
3099+
items: [{ }, { }],
3100+
});
3101+
3102+
this.instance.option('orientation', 'vertical');
3103+
3104+
const pointer = pointerMock(this.getResizeHandles().eq(0));
3105+
pointer.start().dragStart().drag(0, 50).dragEnd();
3106+
3107+
this.assertLayout(['75', '25']);
3108+
});
3109+
30963110
QUnit.test('drag resize should work after setting pane size to 0 programmatically', function(assert) {
30973111
this.reinit({
30983112
width: 208, height: 208,

0 commit comments

Comments
 (0)