You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
496 B
24 lines
496 B
|
3 years ago
|
import {
|
||
|
|
getTranslate
|
||
|
|
} from '../../shared/utils.js';
|
||
|
|
export default function getSwiperTranslate(axis = this.isHorizontal() ? 'x' : 'y') {
|
||
|
|
const swiper = this;
|
||
|
|
const {
|
||
|
|
params,
|
||
|
|
rtlTranslate: rtl,
|
||
|
|
translate,
|
||
|
|
$wrapperEl
|
||
|
|
} = swiper;
|
||
|
|
|
||
|
|
if (params.virtualTranslate) {
|
||
|
|
return rtl ? -translate : translate;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (params.cssMode) {
|
||
|
|
return translate;
|
||
|
|
}
|
||
|
|
let currentTranslate = getTranslate(swiper, axis);
|
||
|
|
if (rtl) currentTranslate = -currentTranslate;
|
||
|
|
return currentTranslate || 0;
|
||
|
|
}
|