mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Some cleaning and usage of getIsElementRTL
This commit is contained in:
parent
8488f48f99
commit
99a67bee64
3 changed files with 10 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
import './emby-scrollbuttons.scss';
|
import './emby-scrollbuttons.scss';
|
||||||
import 'webcomponents.js/webcomponents-lite';
|
import 'webcomponents.js/webcomponents-lite';
|
||||||
import '../emby-button/paper-icon-button-light';
|
import '../emby-button/paper-icon-button-light';
|
||||||
import globalize, { getIsRTL } from '../../scripts/globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ const EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
|
||||||
// TODO: Check if hack is really needed
|
// TODO: Check if hack is really needed
|
||||||
// hack alert add twenty for rounding errors
|
// hack alert add twenty for rounding errors
|
||||||
let localeAwarePos = scrollPos;
|
let localeAwarePos = scrollPos;
|
||||||
if (getIsRTL()) {
|
if (globalize.getElementIsRTL(scrollButtons)) {
|
||||||
localeAwarePos *= -1;
|
localeAwarePos *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import browser from '../../scripts/browser';
|
||||||
import dom from '../../scripts/dom';
|
import dom from '../../scripts/dom';
|
||||||
import './navdrawer.scss';
|
import './navdrawer.scss';
|
||||||
import '../../assets/css/scrollstyles.scss';
|
import '../../assets/css/scrollstyles.scss';
|
||||||
import { getIsRTL } from '../../scripts/globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
|
|
||||||
function getTouches(e) {
|
function getTouches(e) {
|
||||||
return e.changedTouches || e.targetTouches || e.touches;
|
return e.changedTouches || e.targetTouches || e.touches;
|
||||||
|
@ -75,7 +75,7 @@ class NavDrawer {
|
||||||
const endX = touch.clientX || 0;
|
const endX = touch.clientX || 0;
|
||||||
const endY = touch.clientY || 0;
|
const endY = touch.clientY || 0;
|
||||||
let deltaX = endX - (this.menuTouchStartX || 0);
|
let deltaX = endX - (this.menuTouchStartX || 0);
|
||||||
if (getIsRTL()) {
|
if (globalize.getIsRTL()) {
|
||||||
deltaX *= -1;
|
deltaX *= -1;
|
||||||
}
|
}
|
||||||
const deltaY = endY - (this.menuTouchStartY || 0);
|
const deltaY = endY - (this.menuTouchStartY || 0);
|
||||||
|
@ -111,7 +111,7 @@ class NavDrawer {
|
||||||
const endX = touch.clientX || 0;
|
const endX = touch.clientX || 0;
|
||||||
const endY = touch.clientY || 0;
|
const endY = touch.clientY || 0;
|
||||||
let deltaX = endX - (this.menuTouchStartX || 0);
|
let deltaX = endX - (this.menuTouchStartX || 0);
|
||||||
if (getIsRTL()) {
|
if (globalize.getIsRTL()) {
|
||||||
deltaX *= -1;
|
deltaX *= -1;
|
||||||
}
|
}
|
||||||
const deltaY = endY - (this.menuTouchStartY || 0);
|
const deltaY = endY - (this.menuTouchStartY || 0);
|
||||||
|
@ -169,7 +169,7 @@ class NavDrawer {
|
||||||
if (endX <= options.width && this.isVisible) {
|
if (endX <= options.width && this.isVisible) {
|
||||||
this.countStart++;
|
this.countStart++;
|
||||||
let deltaX = endX - (this.backgroundTouchStartX || 0);
|
let deltaX = endX - (this.backgroundTouchStartX || 0);
|
||||||
if (getIsRTL()) {
|
if (globalize.getIsRTL()) {
|
||||||
deltaX *= -1;
|
deltaX *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ class NavDrawer {
|
||||||
const touch = touches[0] || {};
|
const touch = touches[0] || {};
|
||||||
const endX = touch.clientX || 0;
|
const endX = touch.clientX || 0;
|
||||||
let deltaX = endX - (this.backgroundTouchStartX || 0);
|
let deltaX = endX - (this.backgroundTouchStartX || 0);
|
||||||
if (getIsRTL()) {
|
if (globalize.getIsRTL()) {
|
||||||
deltaX *= -1;
|
deltaX *= -1;
|
||||||
}
|
}
|
||||||
this.checkMenuState(deltaX);
|
this.checkMenuState(deltaX);
|
||||||
|
@ -218,7 +218,7 @@ class NavDrawer {
|
||||||
animateToPosition(pos) {
|
animateToPosition(pos) {
|
||||||
const options = this.options;
|
const options = this.options;
|
||||||
requestAnimationFrame(function () {
|
requestAnimationFrame(function () {
|
||||||
options.target.style.transform = pos ? 'translateX(' + (getIsRTL() ? -pos : pos) + 'px)' : 'none';
|
options.target.style.transform = pos ? 'translateX(' + (globalize.getIsRTL() ? -pos : pos) + 'px)' : 'none';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import dom from '../scripts/dom';
|
||||||
import focusManager from '../components/focusManager';
|
import focusManager from '../components/focusManager';
|
||||||
import ResizeObserver from 'resize-observer-polyfill';
|
import ResizeObserver from 'resize-observer-polyfill';
|
||||||
import '../assets/css/scrollstyles.scss';
|
import '../assets/css/scrollstyles.scss';
|
||||||
import { getIsRTL } from '../scripts/globalize';
|
import globalize from '../scripts/globalize';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return type of the value.
|
* Return type of the value.
|
||||||
|
@ -269,7 +269,7 @@ const scrollerFactory = function (frame, options) {
|
||||||
newPos = within(newPos, pos.start, pos.end);
|
newPos = within(newPos, pos.start, pos.end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getIsRTL())
|
if (globalize.getIsRTL())
|
||||||
newPos *= -1;
|
newPos *= -1;
|
||||||
|
|
||||||
if (!transform) {
|
if (!transform) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue