Skip to content

Commit

Permalink
retrieve direction logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ksercs committed Oct 14, 2024
1 parent ea3ea3c commit f7427e7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/devextreme/js/__internal/ui/m_multi_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ const MultiView = CollectionWidget.inherit({
index -= count;
}

const step = direction > 0 ? 1 : -1;
const isLastNotLoopedIndex = direction > 0 ? count - 1 : 0;
while (!this._isItemVisible(index) && (loop || index !== isLastNotLoopedIndex)) {
const step = direction > 0 ? -1 : 1;
const lastNotLoopedIndex = step === -1 ? 0 : count - 1;
while (!this._isItemVisible(index) && (loop || index !== lastNotLoopedIndex)) {
index = (index + step) % count;
}

Expand Down Expand Up @@ -161,7 +161,7 @@ const MultiView = CollectionWidget.inherit({
currentSelectedIndex = items.length - 1;
}

const direction = this._getRTLSignCorrection();
const direction = -1 * this._getRTLSignCorrection();
let newSelectedIndex = this._normalizeIndex(currentSelectedIndex, direction, loop);
if (newSelectedIndex === currentSelectedIndex) {
newSelectedIndex = this._normalizeIndex(currentSelectedIndex, -direction, loop);
Expand Down Expand Up @@ -424,7 +424,7 @@ const MultiView = CollectionWidget.inherit({

_swipeUpdateHandler(e) {
const { offset } = e;
const swipeDirection = -sign(offset) * this._getRTLSignCorrection();
const swipeDirection = sign(offset) * this._getRTLSignCorrection();

const selectedIndex = this.option('selectedIndex');
const newIndex = this._normalizeIndex(selectedIndex - swipeDirection, swipeDirection);
Expand Down

0 comments on commit f7427e7

Please sign in to comment.