Skip to content

Commit

Permalink
Fix Direction.resolve for rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
layalk committed Dec 5, 2023
1 parent 87b3be2 commit 687e132
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/direction.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { define } from '../utils/object'
const VALID_DIRECTIONS = ['ltr', 'rtl']
const FLIPED_MOVEMENTS = {
'>': '<',
'<': '>',
'=': '='
'<': '>'
}

export default function (Glide, Components, Events) {
Expand All @@ -26,10 +25,10 @@ export default function (Glide, Components, Events) {
* @returns {String}
*/
resolve (pattern) {
const token = pattern.slice(0, 1)

if (this.is('rtl')) {
return pattern.split(token).join(FLIPED_MOVEMENTS[token])
return pattern.split('').map(function (c) {
return FLIPED_MOVEMENTS[c] || c
}).join('')
}

return pattern
Expand Down

0 comments on commit 687e132

Please sign in to comment.