mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(client/rtl): sidebar not draggable
This commit is contained in:
parent
06d87dc94b
commit
3e54e0fc42
@ -66,7 +66,7 @@ export default class SidebarContainer extends FlexContainer<BasicWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const x = "touches" in e ? e.touches[0].clientX : e.clientX;
|
const x = "touches" in e ? e.touches[0].clientX : e.clientX;
|
||||||
const deltaX = x - this.startX;
|
const deltaX = glob.isRtl ? this.startX - x : x - this.startX;
|
||||||
if (this.dragState === DRAG_STATE_INITIAL_DRAG) {
|
if (this.dragState === DRAG_STATE_INITIAL_DRAG) {
|
||||||
if (this.currentTranslate === -100 ? deltaX > DRAG_CLOSED_START_THRESHOLD : deltaX < -DRAG_OPENED_START_THRESHOLD) {
|
if (this.currentTranslate === -100 ? deltaX > DRAG_CLOSED_START_THRESHOLD : deltaX < -DRAG_OPENED_START_THRESHOLD) {
|
||||||
/* Disable the transitions since they affect performance, they are going to reenabled once drag ends. */
|
/* Disable the transitions since they affect performance, they are going to reenabled once drag ends. */
|
||||||
@ -87,7 +87,11 @@ export default class SidebarContainer extends FlexContainer<BasicWidget> {
|
|||||||
const width = this.sidebarEl.offsetWidth;
|
const width = this.sidebarEl.offsetWidth;
|
||||||
const translatePercentage = Math.min(0, Math.max(this.currentTranslate + (deltaX / width) * 100, -100));
|
const translatePercentage = Math.min(0, Math.max(this.currentTranslate + (deltaX / width) * 100, -100));
|
||||||
this.translatePercentage = translatePercentage;
|
this.translatePercentage = translatePercentage;
|
||||||
this.sidebarEl.style.transform = `translateX(${translatePercentage}%)`;
|
if (glob.isRtl) {
|
||||||
|
this.sidebarEl.style.transform = `translateX(${-translatePercentage}%)`;
|
||||||
|
} else {
|
||||||
|
this.sidebarEl.style.transform = `translateX(${translatePercentage}%)`;
|
||||||
|
}
|
||||||
this.backdropEl.style.opacity = String(Math.max(0, 1 + translatePercentage / 100));
|
this.backdropEl.style.opacity = String(Math.max(0, 1 + translatePercentage / 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user